Python Selenium – how to click and pick from the dropdown list items without select tag


I’m new to Python and Selenium, try to automate filling out the form and get the game gift.

Here is a html, and it uses list items instead of select tag.

                <th>Server Name</th>
                    <!-- toDev liのdata-value属性に設定して頂いた値が下のhiddenに入ります。 --> <input
                    type="hidden" name="server" class="js-selected-server">
                    <ul class="serialForm__select js-select-form" data-type="server">
                        <li><span class="js-selected-text">Select Server</span>
                            <div class="serialForm__select--btn">
                                <img class="iconArrow" data-type="primary"
                                    src="/img/nav/nav_arrow01.svg"> <img class="iconArrow"
                                    data-type="secondary" src="/img/nav/nav_arrow02.svg">
                        <li data-value="1">Orchard(KOR)</li>
                        <li data-value="2">Dynasty(CHN)</li>
                        <li data-value="3">Warlord(SEA)</li>
                        <li data-value="4">Conquest(US)</li>
                        <li data-value="5">Invincible(JP)</li>
                        <li data-value="6">Inferno(TW)</li>
                        <li data-value="7">Ascension(KOR)</li>

Script is able to click the dropdown menu, but not able to pick any of the listed items.
enter image description here

I tried the following and none of those works.

# dropdown = Select(select_server)
# dropdown.select_by_visible_text('Conquest(US)')
# dropdown.select_by_index('4')

My code:

from selenium import webdriver
from import Select

import time

edge_options = {
    "executable_path": "/edgedriver_mac64/msedgedriver",
    # ofcourse change path to driver you downloaded.
    "capabilities": {
        "platformName": 'mac os x',  # I get this from Chrome driver's capabilities
        # "os" : "OS X", # also ok.
browser = webdriver.Edge(**edge_options)


select_server = browser.find_element_by_css_selector(


## below are still testing, not working yet 
# dropdown = Select(select_server)
# dropdown.select_by_visible_text('Conquest(US)')
# dropdown.select_by_index('4')

Any help is appreciated, thanks.


You can try this


Answered By – itronic1990

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published