I want to make automatization in new user creation on IP cameras through the WEB interface, but I can't get options from a "Select" element. element.options return an empty list, element.select_by_value() raise exception "NoSuchElementException("Cannot locate option with value: %s" % value) selenium.common.exceptions.NoSuchElementException: Message: Cannot locate option with value: 21". The same results with finding element by XPATH(element = Select(wb.find_element(By.XPATH, "//*[@id='index_id']"))) Thanks for any help.
HTML object description:
<span>
<select name="index" id="index_id" onchange="onchangeUserList()" style="width:150px;position: absolute;left: 30px;">
<option value="0">username0</option>
<option value="1">username1</option>
<option value="21">--New user--</option>
<option value="22">--Select a user type--</option>
</select>
</span>
part of my python code:
wb = webdriver.Chrome()
wb.get(address)
element = Select(wb.find_element(By.NAME, 'index'))
print(element.options)
element.select_by_value('21')
CodePudding user response:
The problem was solved with driver.implicitly_wait()
.
More information here.