How should I click on an item in this drop-down menu with Selenium + Python?
<div class="form-group pull-right">
<select name="per_page" class="form-control" onchange="this.form.submit()">
<!-- <option value="5" >5</option> -->
<option value="10">10</option>
<option value="20">25</option>
<option value="50">50</option>
<option value="100" selected="selected">100</option>
</select>
</div>
Here's my code:
select_obj = Select(driver.find_element_by_class_name('form-control'))
select_obj.select_by_visible_text('100')
I get this error:
Message: Select only works on <select> elements, not on <input>
Use the "name" attribute instead of "class" attribute:
select_obj = Select(driver.find_element_by_name("per_page"))
select_obj.select_by_visible_text("100")
Hope it helps you!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.