WaitForElementPresent, WaitForElementToLoad - Selenium IDE
WaitForElementPresent and WaitForElementToLoad - Selenium IDE command
WaitForElementPresent and WaitForElementToLoad are no longer needed with UI.Vision RPA for Chrome and its implementation of the Selenium IDE commands. Just like webDriver, the new UI.Vision RPA IDE uses implicit waiting.
Sometimes elements take their time to appear on a page when you are navigating through pages or clicking on buttons or doing something else. The typical example here would be a button click that triggers an ajax call to the backend, and some time later the web page is updated. In the classic Firefox Selenium IDE "waitForElementPresent" command was used to pause selenium playback while targeted element is not present on the page. Once element appears on the page, selenium would continue executing next command.
Now: An implicit wait tells WebDriver/Selenium IDE to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. In webDriver code this looks like driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);. In UI.Vision RPA for Chrome you can set the default timeout in the settings page and also change it on a per macro basis with the Store | new value | !TIMEOUT_WAIT variable:
Alternative "Wait for element" method
If the HTML element that we want to wait for is visible on the website (e. g. a button) there is another option: The visual GUI testing commands visualAssert and visualVerify can be used to wait for a page element to appear. Since the visual "wait for element" solution does not rely on any HTML internals, it works with even the most complex web apps and desktop apps.
Implicit Waiting Example
|open||https://some url to generate a link.com/|
|Assume website needs some time to display the link (e. g. ajax call)|
|UI.Vision RPA Status Display: Waiting for element to load (up to 120 seconds)|
|click||link=Download link ready!|
Related Demo Macros
The ready-to-import-and-run source code of all demo macros can be found in the Open-Source RPA software Github repository.
Anything wrong or missing on this page? Suggestions?
...then please contact us.