Home > Net >  How to select this element from this non select drop-down menu using Selenium Webdriver and Python
How to select this element from this non select drop-down menu using Selenium Webdriver and Python

Time:11-19

I'm trying to use Selenium to select the 2nd option (with the text "24 words") from the drop-down menu on this page: myetherwallet

  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    

CodePudding user response:

You need to click on the drop-down bar. Then default option.

Then you can click on second option.

All you need is a Explicit Waits.

driver = webdriver.Chrome(driver_path)
driver.maximize_window()
driver.get("https://www.myetherwallet.com/wallet/access/software?type=mnemonic")
default_option = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.v-select__selection--comma")))
default_option.click()

second_option = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[text()='24 words']/ancestor::div[contains(@id,'item')]")))
second_option.click()

Imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
  • Related