“Подождите, пока страница загрузит Selenium Python” Ответ

Подождите, пока страница загрузит 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!"
Akshay Vs

Как подождать страницу загружается в 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))
)
Mappy Show

Ответы похожие на “Подождите, пока страница загрузит Selenium Python”

Вопросы похожие на “Подождите, пока страница загрузит Selenium Python”

Больше похожих ответов на “Подождите, пока страница загрузит Selenium Python” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования