hi. i test desktop app. i need check not visible element and get (true, or false) example:
if (element.enabled){
to do something
}
else{
to do something another
}
but, when i check this element, ranorex throw ElementNotFoundException then i catch it. But it takes too much time. How to do it faster?
How to check not visible element
Re: How to check not visible element
Hi,
I think there is some confusion in your post. The element is expected to be available on page, just made hidden? You see, if the element is not available at all (not even invisible) Ranorex will always search for it the whole effective timeout (timeout of given element) and then, if not found, throw an ElementNotFoundException exception. If you don't want to get the exception and you know for sure the element is usually gone within few seconds, you can use Exists() method, with defined timeout.
I think there is some confusion in your post. The element is expected to be available on page, just made hidden? You see, if the element is not available at all (not even invisible) Ranorex will always search for it the whole effective timeout (timeout of given element) and then, if not found, throw an ElementNotFoundException exception. If you don't want to get the exception and you know for sure the element is usually gone within few seconds, you can use Exists() method, with defined timeout.
public void CheckIfExists(RepoItemInfo elementToCheck) { if (elementToCheck.Exists(10000)) //exists method with search timeout { //if exist, do something } else { //if does not exists, do something else } }
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: How to check not visible element
Hmm...
So what is the purpose, and what is the usage of the Validate.NotExists method...?
Using that on an element that is not present results in the Element not found error, which defies the purpose...
So what is the purpose, and what is the usage of the Validate.NotExists method...?
Using that on an element that is not present results in the Element not found error, which defies the purpose...
Re: How to check not visible element
It is to validate that an item does not exist. Just because you can not visually see an item does not mean it does not exist in memory. Applications set the visible state of items to false all the time yet the item still exists. It usually depends on how your AUT was developed. Not visible != Not exist. You can test the functionality of Validate.NotExist() with the below steps:
Hope this helps
- Open Notepad
- Track notepad
- Create a validate not exists action on notpad
- Leave notepad open and run the test, it should fail (Element for item <REPONAME>.UntitledNotepad.Self' does exist. )
- Close notepad and run the test, you should get a passing validation
Hope this helps