I have a weird problem. I have a drop down element and I would like to select the value "No". My Selenium Python code will not select the value "No".
I tried to click the element to see if the click works and that the element can be interacted with, visible etc.
The click works, the drop down element opens.
My Selenium Python code is:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
def select_use_for_matching_dropdown(self, value):
# Params value: The value for the Matching drop down Yes or No
try:
select = Select(WebDriverWait(self.driver, 20).until(EC.element_to_be_clickable((By.ID, 'data_configuration_edit_data_object_tab_details_lb_use_for_match'))))
select.select_by_visible_text(str("No"))
except NoSuchElementException, e:
print "Element not found "
print e
self.save_screenshot("select_use_for_matching_dropdown")
The HTML is:
<select id="data_configuration_edit_data_object_tab_details_lb_use_for_match" class="gwt-ListBox marginright">
<option value="yes">yes</option>
<option value="no">no</option>
<option value="exclude data categories">exclude data categories</option>
</select>
Is there any other way I can try to select the value "No"
I have also tried
select = Select(self.driver.find_element_by_id('data_configuration_edit_data_object_tab_details_lb_use_for_match'))
select.select_by_visible_text('No')
Thanks, Riaz