How to change effective timeout

Best practices, code snippets for common functionality, examples, and guidelines.
IvanT
Posts: 25
Joined: Wed Feb 06, 2019 8:00 pm

How to change effective timeout

Post by IvanT » Wed Apr 17, 2019 8:07 pm

How to change effective timeout "element" from user code???
i don't have this element in repository.

while(true){
try{
Element element = Host.Local.FindSingle("//rawtext[@rawtext='skv-210']");
to do ...
break;
}
catch(ElementNotFoundException){
//I leaf to the next page
repo.GEOTOOLSУ.Form65280.Down.Click();
}

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5330
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to change effective timeout

Post by odklizec » Thu Apr 18, 2019 7:55 am

Hi,

If you mean effective timeout for element searched via FindSingle, then EffectiveTimeout does not apply here. EffectiveTimeout is just repository-related thing. In case you want shorten FindSingle search time, you can do this by adding duration parameter, like this:

Code: Select all

Host.Local.FindSingle("//rawtext[@rawtext='skv-210']", 5000);

BTW, I would suggest to pass both xpath and repo element to your code via method's argument (as string and repoiteminfo variable nad then convert the repoiteminfo to adapter). Using xpaths and repo elements directly in code, as you do it now, only creates messy and unsustainable code. Sure, it's (a bit) faster to type the repo element and xpath directly in code. But it will take much longer to maintain and even understand such messy code. You will see in few months as your project will grow up ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration