Selenium WebDriver Error: AttributeError: 'list' object has no attribute 'click'

0 votes

I want to use the click command on my test page. But I'm getting the below error. I've written it in python. 

Traceback (most recent call last):
File "C:\Users\admin\workspace\LDC\test.py", line 13, in <module>
driver.find_elements_by_link_text("MISCQA Misc Tests").click()
AttributeError: 'list' object has no attribute 'click'

And below is my code. Please help.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By 
from selenium.common.exceptions import NoSuchElementException 
from selenium.webdriver.support.ui import WebDriverWait
import config

url = config.config.get('url')

driver = webdriver.Ie()
driver.get(url)

driver.find_elements_by_link_text("MISCQA Misc Tests").click()

driver.close()
Jun 8, 2018 in Selenium by eLiJha
• 760 points
9,622 views

2 answers to this question.

0 votes
The error is because your using driver.find_elements instead of driver.find_element. That's a syntactical mistake. Let me know if it solves it.
answered Jun 8, 2018 by king_kenny
• 3,710 points
Thank you so much )))
Hope you found it useful @Sergey_QA :)
Your example helped me a lot))
Glad that you got an answer.
brow vlw uma letra tava me atrapalhando tbm mas gracas a vc deu tudo certo aki, ate o proximo erro kkkkkkk
Feliz em ajudar
0 votes

If you are going to use a click() remove an S from elements to be element

driver.find_element_by_link_text("MISCQA Misc Tests").click()
answered Jan 17 by lwazi

even though it is getting 

AttributeError: 'list' object has no attribute 'Click'

This means that your code is returning back a list and not an object of the selenium web driver (what you want, object of the class having the function "click()" ).

Most likely, the elements of the list would be the objects.

Print the list after that part of the code and check if the elements of the list are the ones that you need.

Related Questions In Selenium

0 votes
1 answer

'The connection has timed out Error using Selenium Webdriver

Try to use implicit waits to ensure ...READ MORE

answered Apr 17, 2018 in Selenium by niki
3,066 views
+1 vote
1 answer
0 votes
1 answer

Double click a record in a grid using Selenium webdriver

Try Actions class to perform this Actions action ...READ MORE

answered Mar 29, 2018 in Selenium by Damon Salvatore
• 5,540 points
2,059 views
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
3,117 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,349 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,890 points
2,501 views
0 votes
1 answer

How do i click on <input type=file> on any browser if i'm testing with Selenium Webdriver?

Does not matter which OS or which ...READ MORE

answered Apr 29, 2018 in Selenium by king_kenny
• 3,710 points
6,154 views
0 votes
1 answer

Need some advise on the preferred element locators with Selenium WebDriver

Well let's not call it "Hierarchy". But, ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,710 points
188 views