Reputation: 11
I am trying to click a button with the .click
method, but if I type .cl
, my IDE doesn’t even suggest the .click
function. The Chrome window opens but then after that, Python throws an error. I added two pictures - in the first, you can see my code, and in the second, you can see the error that is thrown:
Upvotes: 0
Views: 167
Reputation: 3619
As you can see from the error, Python tries to access the Click
attribute for a list
object. This is happening because the .find_elements_by_xpath() method returns a list.
Therefore, the solution for your problem would be to pull an item from that list and use the click
method on it, rather than on the list itself.
sb[0].click()
Upvotes: 1