Current scenario is some page needs more time to loading. I want click an element when it was present, But no need wait for whole page load complete. How to fix this problem? Can provide some demo or example?
Thanks a lot.
Current scenario is some page needs more time to loading. I want click an element when it was present, But no need wait for whole page load complete. How to fix this problem? Can provide some demo or example?
Thanks a lot.
The driver.get()
call is blocking. There is a beta feature in the Firefox driver that could work combined with explicit waits:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
profile = webdriver.FirefoxProfile()
profile.set_preference("webdriver.load.strategy", "unstable")
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("http://somedomain/url_that_delays_loading")
try:
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.ID,'someid'))
)
finally:
driver.quit()