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()
Very new at this but I can't seem to figure this out between the Selenium doc, and StackO.
This raises the:
raise TimeoutException(message, screen, stacktrace)
TimeoutException
Again, new at this. I'm fairly sure the java script I want to access is src="/Scripts/AppScripts/GeneralController.js" (?v=1.2). Which has the xpath of /html/body/script[15]. However, my access method could be the mistake itself.
Any insight is appreciated. Thanks, C.
src="/Scripts/AppScripts/GeneralController.js?v=1.2? What is your next action? - DebanjanB