How do I make dynamic timeout in below line of code - if its not found witin 30sc then exit
WebDocument webdoc = "/dom[@browser='ww.ya.com']";
Thank you in advance
how to timeout on searching webdocument
- artur_gadomski
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
- Contact:
Re: how to timeout on searching webdocument
This is a piece of code that we deemed worthy of entering into our Ranorex best Practices document. Screnshot is there to visually verify failure, Snapshot to analyze paths in case it's the path is wrong. Failure instead of Error as errors are not seen on top level in Ranorex report. we use timeSpan as it's easy to see how long it takes (once you know it's hours, minutes, seconds).
WebDocument webdoc; bool found = Host.Local.TryFindSingle("/dom[@browser='www.ya.com']", new TimeSpan(0,0,30), out webdoc); if (!found) { Report.Failure("Webdoc not found."); Report.Screenshot(); Report.Sanpshot(Host.Local); return; }
Re: how to timeout on searching webdocument
Thank you so much artur_gadomski for explained detail with code snippet, thank you again
Tipu