+ 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,

9th Nov 2019, 3:03 AM
Cindy Hernandez
Cindy Hernandez - avatar
11 Answers
+ 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.
9th Nov 2019, 3:08 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Sorry I'm a beginner , let me see if i can paste it correctly
9th Nov 2019, 3:11 AM
Cindy Hernandez
Cindy Hernandez - avatar
+ 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)
9th Nov 2019, 3:12 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
ok tnx
9th Nov 2019, 3:17 AM
Cindy Hernandez
Cindy Hernandez - avatar
+ 1
let me try that ;)
9th Nov 2019, 3:25 AM
Cindy Hernandez
Cindy Hernandez - avatar
+ 1
same error
9th Nov 2019, 3:40 AM
Cindy Hernandez
Cindy Hernandez - avatar
+ 1
Thanks
9th Nov 2019, 3:56 AM
Cindy Hernandez
Cindy Hernandez - avatar
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 ?
9th Nov 2019, 3:20 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Cindy Hernandez then do as I said. Share the code, and give more info.
9th Nov 2019, 12:15 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Cindy Hernandez i think it is the XPath error.. Don't worry.. Send the website details.. I will debug and tell..
11th Nov 2019, 3:11 AM
Dilji
Dilji - avatar