Check if repo item does not exist then do work

Ask general questions here.
tronicza
Posts: 1
Joined: Mon Dec 07, 2015 4:33 pm

Check if repo item does not exist then do work

Post by tronicza » Mon Dec 07, 2015 4:42 pm

Hi all,

I have a situation where I added an object(objectA) to my repo, it is text which sometimes exists inside a table(datagrid). When the text is not there, i want to insert it, otherwise move on.

I have written the following if statement:
if(!repo.App.Form.objectA.Exsists())
{
//do work to insert
}

When the text is in the table, my solution works and the code '//do work to insert' is skipped as expected.
However, when the text is not in the table, my solution gets stuck at this point and just hangs.

The same problem occurs when i use .Visible

Any ideas?
Thanks in Advance!!

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

Re: Check if repo item does not exist then do work

Post by odklizec » Wed Dec 09, 2015 9:01 am

Hi,

I think the problem you are experiencing is not that your code hangs. I think it rather waits too long? Please examine the 'Effective Timeout' value of given repo element. The solution of your problem could be setting shorter Exists timeout, like this...

Code: Select all

if(!repo.App.Form.objectA.Exists(5000)) //Exists method stops searching the element after 5 secs
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