0

Click here for see the codeI'm learning python, but I don't know how to select this part, anyone help me?

I tried to select the cell with xpath and put the country but I don't know how to select it to assign the value

test = driver.find_element_by_xpath("//input[@type='search']")
test.send_keys('United States')
test.click()

2 Answers2

0

What you want to do is to select the list item.

from selenium import webdriver
from selenium.webdriver.support.ui import Select

driver = webdriver.Firefox()
driver.get('url')

select = Select(driver.find_element_by_xpath("//input[@type='search']"))

# select by visible text
select.select_by_visible_text('United States')

# select by value 
select.select_by_value('3')

Link to original answer](How to select a drop-down menu value with Selenium using Python?).

  • What you are clicking on in the image is IFRAME. It is not the element you want. Check the
      that is what actually holds the element
    • . I think you are providing the XPATH to the IFRAME instead of the ul @BrianDaniel
    –  Oct 20 '21 at 18:41