Home > database >  Selenium overlay button cannot be clicked
Selenium overlay button cannot be clicked

Time:11-30

I am having some issues with one website's button. Here is my driver function.

def get_driver():
    options = webdriver.ChromeOptions()
#     options.add_argument("--headless")
    options.add_argument("--incognito")
    driver = webdriver.Chrome(executable_path = ChromeDriverManager().install(),     chrome_options = options)
    driver.get('https://online.depo-diy.lt')
    return driver

driver = get_driver()

Problem is that I cannot select and click anything from the drop down manu when I start my driver. Website request to select a store and then you can press OK to proceed. I check for iframes with driver.window_handles but it shows only one frame. This seems like overlay, but I don't know what to do with it.

Only button I can find is "//button[@class='ms-Button-flexContainer flexContainer-51']". Here is the screenshot, don't know how to copy HTML output..
enter image description here Blockquote

CodePudding user response:

Try this:

WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "ModalFocusTrapZone30")))
driver.find_element(By.ID, "Dropdown31-option").click()
time.sleep(1)
driver.find_element(By.XPATH, ".//*[contains(text(), 'Šilutės 28B, Klaipėda')]").click()
time.sleep(1)
driver.find_element(By.XPATH, ".//*[@data-automationid='splitbuttonprimary']//span[text()='OK']").click()
  • Related