from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
url = "https://www.electionreturns.pa.gov/General/OfficeResults?OfficeID=13&ElectionID=undefined&ElectionType=undefined&IsActive=1"
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
driver = webdriver.Chrome(r"...\chromedriver.exe", options = options)
driver.get(url)
try:
element = WebDriverWait(driver,20).until(
EC.visibility_of_element_located((By.XPATH, "/html/body/script[15]"))
)
finally:
driver.quit()
Очень новичок в этом, но я не могу понять это между Selenium doc и StackO.
Это поднимает:
raise TimeoutException(message, screen, stacktrace)
TimeoutException
Опять, новое в этом.Я вполне уверен, что Java-скрипт, к которому я хочу получить доступ, src="/Scripts/AppScripts/GeneralController.js"
(?v=1.2
).Который имеет xpath /html/body/script[15]
.Тем не менее, мой метод доступа может быть самой ошибкой.
Любое понимание приветствуется.Спасибо, С.