How to gve specific timeout for NotExist

Ask general questions here.
rsudhak
Posts: 78
Joined: Fri Jan 04, 2019 1:38 pm

How to gve specific timeout for NotExist

Post by rsudhak » Mon Jul 15, 2019 10:33 am

Hi,

I am clicking on all items in a list , my steps are click on an item in the list and click add button. I want to stop when it throws an error when adding.

I tried Validate.NotExist(errorElementInfo), but this waits long after each item is added. I want to wait say just for a second before it validates, this should include search the element as well as validate , how can I do that.

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

Re: How to gve specific timeout for NotExist

Post by odklizec » Mon Jul 15, 2019 11:44 am

Hi,

In my opinion, the only way how to achieve what you want is using user code and RepoItemInfo.Exists(Duration) method. This way you can do whatever you want with if given repo item exists or not and you don't have to wait its entire effective timeout. On the other hand, it's limited to code-based steps.

Code: Select all

public void CheckIfNotExists(RepoItemInfo repoItemToFind)
{
    if (!repoItemToFind.Exists(5000))
    {
        //if element does not exists, do whatever you want
    }
    else
    {
        //do something else
    }
}
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