1

With this current block of code I am getting a timeout exception error and I am not exactly sure why. Can someone help me fix it? The program currently will get to the correct webpage, it just won't do anything after that. I originally added the wait to help the program in finding the xpath for a text entry box when I was thinking the issue was that the webpage wasn't loading quickly enough. Can someone help me fix this issue so that the program can find the xpath correctly and not timeout?

driver = webdriver.Chrome(executable_path="/Users/username/webdrivers/chromedriver")
driver.get("https://www.vinsolutions.com")

loginButton = driver.find_element("xpath", '//*[@id="top-menu"]/li[6]/a')
loginButton.click()

userNameBox = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.XPATH, '//*[@id="username"]'))
)
userNameBox.send_keys('username')
Banthrall
  • 27
  • 1

2 Answers2

0

you can access the login page directly:

driver = webdriver.Chrome(executable_path="/Users/username/webdrivers/chromedriver")
driver.get("https://apps.vinmanager.com/")

userNameBox = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.XPATH, '//*[@id="username"]'))
)
userNameBox.send_keys('username')
justin
  • 197
  • 6
0

Your page is loading a little slow after clicking login button you just need to wait around 30 seconds

You can wait for the page to load or wait for the element

userNameBox = WebDriverWait(driver, 30).until(
    EC.presence_of_element_located((By.XPATH, '//*[@id="username"]'))
)
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36