6. Selenium Webdriver with Python Tutorial – Basic Actions #2

///6. Selenium Webdriver with Python Tutorial – Basic Actions #2

6. Selenium Webdriver with Python Tutorial – Basic Actions #2

FavoriteLoadingAdd to favorites

In this video, I explain how to select an option from a drop-down list using Selenium Webdriver and Python. I am selecting the option by visible text.

“Selenium Webdriver Python Training”
“Selenium Webdriver Python Tutorial”
“Selenium Python”
“Selenium Send_Keys”
“Selenium Click”
“Selenium Grid”
“Selenium IDE”
“Page Objects”
“UI Map”
“Css Selector”
“Drop-down selenium”
“Drop-down option selenium”


By |2020-05-07T03:27:40+00:00May 7th, 2020|Python Video Tutorials|5 Comments


  1. Marcus Hines May 7, 2020 at 3:27 am - Reply

    For anyone who does not know, you must prefix all of the names of your test methods with 'test'. I did not know this and was troubleshooting for 30 mins before it occurred to me.

  2. Farooq Kadri May 7, 2020 at 3:27 am - Reply


    I have the below HTML code:

    <div class="resultDiv">
    <span class="">Sort by : </span>
    <div class="dropdown num-record">
    <button id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    <span class="jsSortTypeText">Relevant</span>
    <i class="icon-arrows_down"></i>
    <ul class="dropdown-menu" aria-labelledby="dLabel" style="display: none;">
    <li class="jsSortType" data-value="Prem" data-label="VIP first">VIP first</li>
    <li class="jsSortType" data-value="Rec" data-label="Recent">Recent</li>
    <li class="jsSortType jsDefaultSort selected" data-value="Rel" data-label="Relevant">Relevant</li>

    I am trying to click on the element "dLabel" or "ul" and then click the option "Recent".

    I have tried to use action chain,xpath,css selector but nothing works.When using action chain and the test runs without any error but the click does not happen.

    Can someone please guide me what I am doing wrong.Below is my code which runs without any errors but does not open the dropdown and select the "Recent" option.

    menu1 = WebDriverWait(driver, 20).until(lambda driver: driver.find_element_by_xpath(".//*[@id='dLabel']"))
    clickon = WebDriverWait(driver, 20).until(lambda driver: driver.find_element_by_xpath("html/body/div[2]/div[2]/div[6]/div/div[3]/div[3]/div[1]/div/ul/li[2]"))
    action = ActionChains(driver)

    I even tried using something similar to below:

    #now find Documents link and click
    recent = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "Recent")))

    Then I get a timeout error.Maybe I am using the combination wrong or something.

  3. Sergey Bessonov May 7, 2020 at 3:27 am - Reply

    there is no need the "emailfieldid".

  4. 阿耨 May 7, 2020 at 3:27 am - Reply

    helps a lot! many thanks

  5. Ryan OnFire May 7, 2020 at 3:27 am - Reply

    Hi, bit of noob question but wondering if someone has the answer. I've created a copy of of what is in the tutorial and edited it for different fields and drop-downs for different site's however it remains mostly the same. I require raw_input at the beginning to enter firstName, lastName, so I can auto fill fields however when run the browser opens at the correct page, but then stays at Testing started at 20:09 …. . If I remove class and self it all works without any issues, sure it's something simple.

Leave A Comment