Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

wait for page to load selenium python

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException

browser = webdriver.Firefox()
browser.get("url")
delay = 3 # seconds
try:
    myElem = WebDriverWait(browser, delay).until(EC.presence_of_element_located((By.ID, 'IdOfMyElement')))
    print "Page is ready!"
except TimeoutException:
    print "Loading took too much time!"
Comment

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))
)
Comment

PREVIOUS NEXT
Code Example
Python :: python similar strings 
Python :: how to convert index to column in pandas 
Python :: how to find determinant in numpy 
Python :: python dynamic loop 
Python :: python seaborn heatmap decrease annot size 
Python :: train test split pandas 
Python :: python logger format time 
Python :: create numpy table with random values in range 
Python :: how to show process bar in terminal python 
Python :: count how many vowels in a string python 
Python :: raatatatatatatatatatatatatatatatatatatatatatatatatatatattatana 
Python :: Fill NaN of a column with values from another column 
Python :: split every character python 
Python :: How to use PatBlt in Python 
Python :: matlab find in python 
Python :: rename one dataframe column python 
Python :: python psycopg2 utf8 
Python :: rename coordinate netcdf python xarray 
Python :: how to install python3.6 on ubuntu 
Python :: python find all positions of element in list 
Python :: python test if value is np.nan 
Python :: convert file to base64 python 
Python :: subprocess the system cannot find the file specified 
Python :: triangle pattern in python 
Python :: find matches between two lists python 
Python :: numpy.datetime64 to datetime 
Python :: python scratch cloud variabelen 
Python :: django email settings 
Python :: start django project 
Python :: Print a nested list line by line 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =