waitForVisible - Selenium IDE
waitForVisible (locator) - Selenium IDE command
The waitForVisible tells the IDE to wait for an element to exist and be visible. This command will wait till element visible on the page. Once command will visible on page, the Ui.Vision RPA selenium IDE will go for executing next command.
Test page: Wait for element to become visible.
waitForVisible combined with !statusOK can be used to recreate the assertVisible/verifyVisible and assertNOTVisible/verifyNOTVisible commands of the old Firefox Selenium IDE.
Alternative "Wait for Visible" method
Another option to check for visibility are the visual GUI testing commands visualAssert and visualVerify. These commands wait for an image to appear. Since the visual "wait for visible" solution does not rely on any HTML internals, it works with even the most complex web apps and desktop apps.
waitForVisible Example
The macro below is a basic example. You find a more detailed example in the DemoImplicitWaiting demo macro that gets installed with the RPA software!
Command | Target | Pattern/Text |
---|---|---|
open | https://ui.vision/demo/waitforvisible | |
waitForVisible | css=#div1 > h1 | |
echo | The text is now visible |
waitForNotVisible Example
The inverse version of waitForVisible would the waitForNotVisible of the classic Firefox Selenium IDE. It will wait for invisibility of the element on the page. This is very rarely used command and can be simulated easily with existing commands. Just like with assertVisible mentioned above, we decided to not support it with Ui.Vision RPA software to keep things lean.
You can recreate waitForNotVisible with the while / end loop. The loop checks the result of WaitForVisible via the !statusOK internal variable. When the element is (still) visible the !statusOK is TRUE and the while loop continues. But once the element is hidden (and after waiting for it until !timeout_wait) then !statusOK is FALSE and the while loop breaks and the macro continues. You need to set !errorIgnore = TRUE so the macro does not stop at the "element not visible" error. The screencast below shows the macro in action.
Command | Target | Pattern/Text |
---|---|---|
open | https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp | |
store | true | !errorignore |
while | ${!statusOK} | |
waitForVisible | id=myDIV | |
end | ||
echo | The text is now hidden! | |
store | false | !errorignore |
Works in
Ui.Vision RPA for Chrome Selenium IDE, Ui.Vision RPA for Firefox Selenium IDE, Firefox IDE Classic
Related Demo Macros
ClickandWait is part of almost every demo macro-
The ready-to-import-and-run source code of all demo macros can be found in the Open-Source RPA software Github repository.
See also
clickAndWait, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.
Anything wrong or missing on this page? Suggestions?
...then please contact us.