Reputation: 110312
How would I accomplish the following in python's selenium:
el = WebDriverWait(self.driver, 10).until(
expected_conditions.js_return_value(
("return document.readyState === 'complete' ? true : false")
)
)
I've seen ways to do the above in Java, but cannot find a similar solution in python
Upvotes: 1
Views: 161
Reputation: 1733
I did something similar but used the __call__
class function to get the same effect, like this:
class DynamicLoadState:
def __call__(self, driver):
LoadComplete = False
if driver.execute_script("return document.readyState") == 'complete': LoadComplete = True
return LoadComplete
WebDriverWait(self.driver, 10).until(DynamicLoadState())
Upvotes: 1