EnsureVisible does not working

Ask general questions here.
John Silver, Esq.
Posts: 5
Joined: Tue Mar 15, 2011 6:28 pm

EnsureVisible does not working

Post by John Silver, Esq. » Tue Mar 15, 2011 6:41 pm

Hello,

I use the following code to wait for appearing of the titlebar of the tested app:

Code: Select all

            	bool isShown=false;
            	for (int i=0;i<100;i++)
            		try
            		{
	            		if (repo.FormApp.TitleBarApp.EnsureVisible())
		            	{
		            		isShown=true;
		            		break;
		            	}
            		}
            		catch (ElementNotFoundException)
            		{
            			Delay.Milliseconds(1000);
            		}
            		catch(Exception e)
            		{
        				Report.Log(ReportLevel.Info, "myapp", "Error: "+e.Message, new RecordItemIndex(2));
						break;
            		}
The problem is that the repo.FormApp.TitleBarApp.EnsureVisible() always raises the ElementNotFoundException, even the titlebar is already shown.
When I set breakpoint on this line (at this moment I'm sure that titlebar IS visible), I call "HighlightRepositoryItem" from the context menu, and the titlebar becomes highlight. But the repo.FormApp.TitleBarApp.EnsureVisible() still raises the mentioned exception.

OS: Win7 x64, Ranorex Studio v. 3.0.0.11639, repo.FormApp.UseCache is false.

What I'm doing wrong?

Thank You in advance.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: EnsureVisible does not working

Post by Support Team » Wed Mar 16, 2011 5:38 pm

Hi,

Instead of using your code to wait for an element, use the Ranorex methods to wait for an element. We have a nice feature called timeout which handle this for you. :wink: The following documentation explaines how to wait for an element
http://www.ranorex.com/support/user-gui ... eouts.html

Regards,
Peter
Ranorex Team