Managing an unexpected popup with selenium

54 views Asked by At

I am automating tasks within a web based inventory management software. When entering the website through the webdriver a popup appears asking you to accept cookies, normally, this is not an issue because I can inspect and use the xpath to click the element. Because I only see the popup when entering the website through the driver, when inspecting and attempting to copy the full xpath it is incomplete and just shows '/html/body' I have tried other methods for dismissing this popup, but because of my limited experience programming, I can't seem to figure it out.

  • What could be causing this popup to appear when using the driver when entering the website manually does not display the popup?
  • How can I make this popup go away when I can't get the XPath or other information to identify the element by?

The script requires the popup to be dismissed before it can proceed with the steps, here is the code, the popup appears after signup_button.click().

signup_button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.XPATH, '//*[@id="login-content"]/form/div[3]/button'))
)
signup_button.click()
# Wait for the Inventory dropdown menu to be visible

inventory_menu = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div[1]/div/div/div/div[1]/div/div/div[1]/div[5]/div/div[4]/span'))
)
inventory_menu.click()
0

There are 0 answers