+ 1
AttributeError: 'list' object has no attribute 'click'
while trying to run the following i keep getting the error Attribute Error:'list' object has no attribute 'click' (part of the script below) print("finding login button") login_button = driver.find_element_by_name("Enter2") print("clicking 'login'") login_button.click() time.sleep(.4) print("click on the 'download' button") driver.get("website") print("find and click the 'account listing' hyperlink") continue_link = driver.find_elements_by_link_text('account listing') continue_link.click () print("list all hyperlinks on the daily page") allhyperlinks = driver.find_elements_by_xpath("//a[@href]") please help,
10 odpowiedzi
+ 3
We can't work with incomplete code unless it is itself a fully functional one. The code you provided here cannot be read without previous lines.
Also, please specify the language you're using in the tags please.
+ 1
Sorry I'm a beginner , let me see if i can paste it correctly
+ 1
Cindy Hernandez it's okay, you don't have to paste it. Go to code playground and write it there, and save it.
Then, go back to this post, click edit, and insert your code here (there should be a little insert button at the bottom after you click edit)
+ 1
ok tnx
+ 1
let me try that ;)
+ 1
same error
+ 1
Thanks
0
Cindy Hernandez I think I know where the problem is, the driver.find_element_by_name("Enter2") returns a list, and not the element itself. Therefore, the line that generates the error is this:
login_button.click()
If there is only one element with the name Enter2, then change that line to this:
login_button[0].click()
Does the problem still occur ?
0
Cindy Hernandez then do as I said. Share the code, and give more info.
0
Cindy Hernandez i think it is the XPath error.. Don't worry.. Send the website details.. I will debug and tell..