I want need a void check a xpath and return true or false

Ask general questions here.
hungppse03862
Posts: 1
Joined: Mon Jun 27, 2016 5:04 am

I want need a void check a xpath and return true or false

Post by hungppse03862 » Mon Jun 27, 2016 5:11 am

I want need a void check a xpath and return true or false and dont wait time out. Check one time, if exist return true and if dont exist return false immediately - dont wait time out. Please help me if you have any idea.
Thanks you so much! :)

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

Re: I want need a void check a xpath and return true or false

Post by odklizec » Mon Jun 27, 2016 2:11 pm

Hi,

I'm not quite sure what exactly you want to achieve, but if you just want to quickly test the availability of an element without throwing an exception and don't want to wait entire Effective Timeout, you can use for example TryFindSingle method:

Code: Select all

String MyPath ="/form[@title='Calculator']/element[@class='CalcFrame']";  
Ranorex.Unknown myElement = null;  
if (! Host.Local.TryFindSingle(MyPath, 5000, out myElement))  
The above code tests the availability (returns true/false) of an element for given xpath, with 5sec timeout. If the element is found, it's returned to myElement. Hope this helps?
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