Reputation: 261
I am using this function to check the multiple number of checkboxes:
def checkMultipleCheckoxes(self, values):
for i in values:
checkboxes = self.driver.find_elements_by_xpath("//*[@value='%s']"% i)
if not checkboxes.is_selected():
checkboxes.click()
then I am using this in another function to check if these checkboxes are selected if not then i select them:
self.checkMultipleCheckoxes(["13084", "13087", "13088", "13085", "15607", "15608", "15606", "15637", "15605"])
However, I am not sure what I am doing wrong - this is the error I get
AttributeError: 'list' object has no attribute 'is_selected''
Upvotes: 0
Views: 691
Reputation: 25597
checkboxes
is a collection of elements (not a single element) since you are getting the return from .find_elements_*
(plural). You would want to loop through the collection and then check each element to see if is_selected()
is true
. Also, you are using isSelected()
which is Java... you want python which is is_selected()
.
Upvotes: 3