I want to select an option from a select field using Selenium & Python.
The HTML is as follows:
<select autocomplete="off" class="style_input_item" name="AccountEnable" id="Enable" value="0" onchange="onPageDataChange()">
<option value="0" selected="selected"><script>T("Disabled")</script>Disabled</option>
<option value="1"><script>T("Enabled")</script>Enabled</option>
</select>
And I tried as follows:
driver.find_element_by_xpath('//*[@id="Enable"]/option[value="1"]').click()
I received that error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="Enable"]/option[value="0"]"}