Selenium fails to change dropdown selection
<p>Here is the isolated HTML code:</p>

<pre><code>&lt;span style="position: relative; width: 100%; display: inline-block;"&gt;
    &lt;select id="0ac88542d16d6200fb983d094f655c76_select" class="form-control"&gt;
        &lt;option value="display_value"&gt;Number&lt;/option&gt;
        &lt;option value="sys_class_name"&gt;Type&lt;/option&gt;
    &lt;/select&gt;
&lt;/span&gt;
</code></pre>

<p>Using Python Selenium, click on the dropdown element to expand it:</p>

<pre><code>search_elemets = driver.find_elements_by_xpath("//*[@class='form-control']")
search_elemets[0].click()
</code></pre>

<p>Now let's try different scenarios to change its selection to the desired value..</p>

<p>Option 1</p>

<pre><code>Select(search_elemets[0]) \
    .select_by_visible_text("Number")
driver.find_elements_by_tag_name('option')[1].click()
</code></pre>

<p>Option 2</p>

<pre><code>Select(search_elemets[0]) \
    .select_by_value("display_value")
driver.find_elements_by_tag_name('option')[1].send_keys(Keys.RETURN)
</code></pre>

<p>Option 3</p>

<pre><code>for option in search_elemets[0].find_elements_by_tag_name('option'):
    if option.text == 'Number':

        # Use one of the options below
        # Option 3.1
        Select(search_elemets[0]) \
            .select_by_visible_text("Number")
        option.click()
        break

        # Option 3.2
        actions = ActionChains(driver)
        actions.move_to_element(option)
        actions.click(option)
        actions.perform()
        break
</code></pre>

<p>All tries result in a visual click which is performed by the webdriver, but
the value is not changed afterwards..</p>

<p>@katericata Your html is as like- Number Type Type2 Type3</p>

<p>and my web driver class is as, here you can replace the drop down items as Type2,type 3 etc which you want to select.</p>

<p>driver.findElement(By.xpath("code']")).sendKeys("Type3"); } } let me know if there are any concern.</p>

python html selenium selenium-webdriver drop-down-menu