I am trying to check all checkboxes on a page similarily to http://ift.tt/2htoZ09.
I try to do this with
checkboxes = driver.find_elements_by_class_name('gwt-CheckBox')
for checkbox in checkboxes:
if not checkbox.is_selected():
checkbox.click()
however, all checkboxes give False for is_selected()
so the ones that are already selected get switched off and the ones that are not selected get switched on. Below I have an example of the a checked CheckBox class (Library Name) and an unchecked Checkbox class (Paired nominal length).
How can I check if these are already selected?
<div style="position: relative; display: inline-block; vertical-align: top; float: left;">
<span class="gwt-CheckBox">
<input id="gwt-uid-27" tabindex="0" type="checkbox" value="on"/>
<label for="gwt-uid-27">
Library name
</label>
</span>
</div>
</div>
<div class="holderFp" style="width: 100%; position: relative; overflow: hidden; display: block;">
<div style="position: relative; display: inline-block; vertical-align: top; float: left; width: 25%;">
<span class="gwt-CheckBox">
<input id="gwt-uid-28" tabindex="0" type="checkbox" value="on"/>
<label for="gwt-uid-28">
Paired nominal length
</label>
</span>
</div>
Aucun commentaire:
Enregistrer un commentaire