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 :: give a function a name python 
Python :: python spammer 
Python :: Python how to compile to exe file 
Python :: matplotlib log scale y axis base 
Python :: qfiledialog python save 
Python :: Display if the column(s) contain duplicates in the DataFrame 
Python :: python get subset of dictionary 
Python :: python bit shift by 3 
Python :: python grouped bar chart 
Python :: keras declare functional model 
Python :: capwords python 
Python :: how to find in which directory my python code is running 
Python :: python subprocess exception handling 
Python :: read json in python 
Python :: replace empty numbers in dataframe 
Python :: # extract an email ID from the text using regex 
Python :: read a file with pandas 
Python :: stack queue in python 
Python :: slug url 
Python :: how to label points in scatter plot in python 
Python :: midpoint 
Python :: how to run python program in sublime text 3 windows 
Python :: group by in ruby mongoid 
Python :: remove new line character from string python 
Python :: python initialize dict with empty list values 
Python :: roman to integer 
Python :: import python script from another directory 
Python :: remove multiindex pandas 
Python :: NumPy unique Example Get the unique rows and columns 
Python :: pd.read_csv 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =