Best way to execute an action if a control is visible?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Best way to execute an action if a control is visible?
First sorry if this question was already asked but i have created a shared keyword test to try and perform an action only if a control is visible:
Initially in my condition i had only the Control.Visible check but was throwing an error since the control did not exist for that case.
This is when i added the Control.Exists first check.
What bothers me is that this check make my test much slower when the control in question is not available.
For example when this control does exist, it would take 10sec to execute my test. But if it is not available, my test would then take 20-25sec to perform the same thing.
Therefore i was wondering if i was doing the right way or if there was a better way that would speed up the check?
Thanks!
- Labels:
-
Checkpoints
-
Desktop Testing
-
Keyword Tests
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of just Exists, you can use a Wait to do a similar thing and also control the timing. Here's a reference for that:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The existence of an object is based on this time, in project settings.
Note, to check the property value of Visible, the Object must exist.
Best to use what @Marsha_R has mentioned.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Marsha_R thanks for the reply. However in my case there are some cases where the control might not be present at all and it would be ok.
Using changing the timeout might be good for me to reduce the wait time, but .Exists seems to be the only property i can use to avoid a crash and to correctly figure out if the control is available or not.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@rraghvani Thanks!
From what i can read from the links, i can conclude that the approach i am using to determine if a control is available and visible to the user is correct. However i could reduce the wait timeout to avoid waiting too long.
Thanks to both of you!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You use the Wait to see if it exists and then decide what to do it if does exist and what to do if it does not.
There are examples here
