Alex Alex - 3 days ago 4
R Question

how to check if page finished loading in RSelenium

Imagine that you click on an element using

RSelenium
on a page and would like to retrieve the results from the resulting page. How does one check to make sure that the resulting page has loaded? I can insert
Sys.sleep()
in between processing the page and clicking the element but this seems like a very ugly and slow way to do things.

Answer

Set ImplicitWaitTimeout and then search for an element on the page. From ?remoteDriver

setImplicitWaitTimeout(milliseconds = 10000)

Set the amount of time the driver should wait when searching for elements. When searching for a single element, the driver will poll the page until an element is found or the timeout expires, whichever occurs first. When searching for multiple elements, the driver should poll the page until at least one element is found or the timeout expires, at which point it will return an empty list. If this method is never called, the driver will default to an implicit wait of 0ms.

Comments