Choose your fruits: Banana Mango...">
Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to select a drop-down menu option value with Selenium (Python)

Asked by Ananya Pawar Apr 14, 2021 1.2K views 1 answer
Share

About this question

I need to select an element from a drop-down menu.

For example:

<select id="fruits01" class="select" name="fruits">

  

  

  

</select>

First I have to click on it. I do this:

inputElementFruits = driver.find_element_by_xpath("//select[id='fruits']").click()

After that I have to select the good element, let us say Mango.

I tried to do it with inputElementFruits.send_keys(...) but it did not work.

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.