Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to wait a page is loaded in Python Selenium

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

wait = WebDriverWait(driver, 10)
try:
    next_page_elem = self.browser.find_element_by_xpath("//a[text()='%d']" % pageno)

except noSuchElementException:
    break
print('page ', pageno)
next_page_elem.click()

# wait for the page to load
wait.until(
    EC.presence_of_element_located((By.XPATH, "//a[@class = 'on' and . = '%d']" % pageno))
)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #wait #page #loaded #Python #Selenium
ADD COMMENT
Topic
Name
1+2 =