Home > OS >  Selenium, selecting from dropdown
Selenium, selecting from dropdown

Time:10-11

there is a dropdown on a website. I want to select EUR.

I tried all kind of methods (python selenium) i could find on the internet, nothing works for my specific case :(

For example

select = Select(driver.find_element(by.class, ....))
select.select_by_visible_text('...')

Also tried xpath, getting the following error: imgur.com/a/DYfA4UI

Website is: funpay.com/en xpath: '//*[@id="navbar"]/ul[2]/li[4]/ul/li/a'

Anyone able to help?

This is how it looks like: https://imgur.com/a/uJ2xmNl

Thank you in advance

CodePudding user response:

I recommend you try with "CSS seletor" to localize the dropdown with google developer tools and use something like this :

menu = dropdown.find_element_by_css_selector("#li.dropdown")
options = menu.find_elements_by_css_selector('a')
for option in options:
    if option.text == 'EUR':
        eur = option

      
  • Related