How do I change the length of time it searches for?

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

How do I change the length of time it searches for?

Post by stapes » Wed Sep 30, 2015 5:29 pm

In this little bit of code, experimentation has shown that if it gonna find the required button, it does so in about 5 seconds, so I tried to reduce the length of time it wold search for to 10 seconds.

Here is my code:

Code: Select all

Duration searchTimeout = new Duration(10); // time in ms  
			repo.AgileMobileApp.LoginPage.StandardLoginPage.AdvancedButtonInfo.SearchTimeout = searchTimeout;  
And here is the search:

Code: Select all

if(Validate.Exists(repo.AgileMobileApp.LoginPage.StandardLoginPage.AdvancedButtonInfo,"", option))
It is not working as I expected. It still searches for 1 minute.

Is there a way to do this?

keenon
Posts: 14
Joined: Fri May 22, 2015 9:48 pm

Re: How do I change the length of time it searches for?

Post by keenon » Wed Sep 30, 2015 10:12 pm

Hi Stapes,

I think I understand your question. If you are only trying to verify that an element is present before initiating a step in your recording you can use this code for your search instead.

Code: Select all

if(repo.AgileMobileApp.LoginPage.StandardLoginPage.AdvancedButtonInfo.Exists(10000))
This code should search to see if the button is present and will search for 10 seconds. If you want to reduce the search time to 5 seconds you can just replace the 10000 with 5000 and so on. So say you wanted to only select the Advanced button if it is present you can use:

Code: Select all

public void Validate_Advanced_Button()
        {
if(repo.AgileMobileApp.LoginPage.StandardLoginPage.AdvancedButtonInfo.Exists(10000))
        {
Report.Log(ReportLevel.Info, "Mouse", "Click Advanced Button");        		repo.AgileMobileApp.LoginPage.StandardLoginPage.AdvancedButton.Click();
        }
      }
I hope this helps.

Keenan

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: How do I change the length of time it searches for?

Post by stapes » Thu Oct 01, 2015 3:47 pm

Thank you Keenan,that seems to work.