close

[Solved] AttributeError: ‘list’ object has no attribute ‘click’ – Selenium Webdriver

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error AttributeError: ‘list’ object has no attribute ‘click’ – Selenium Webdriver in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: ‘list’ object has no attribute ‘click’ – Selenium Webdriver Error Occurs?

Today I get the following error AttributeError: ‘list’ object has no attribute ‘click’ – Selenium Webdriver in python.

How To Solve AttributeError: ‘list’ object has no attribute ‘click’ – Selenium Webdriver Error ?

  1. How To Solve AttributeError: 'list' object has no attribute 'click' – Selenium Webdriver Error ?

    To Solve AttributeError: 'list' object has no attribute 'click' – Selenium Webdriver Error maybe driver.find_elements_by_link_text("MISCQA Misc Tests")[0].click() or another index…

  2. AttributeError: 'list' object has no attribute 'click' – Selenium Webdriver

    To Solve AttributeError: 'list' object has no attribute 'click' – Selenium Webdriver Error maybe driver.find_elements_by_link_text("MISCQA Misc Tests")[0].click() or another index…

Solution 1

Thanks for helping out. I found the answer for myself. Idea given by “Dan Niero”

The problem is, I am using driver.find_element[s] instead of driver.find_element. So one s makes difference and calling a wrong method. In fact I am following the eclipse autocomplete :(. Obviously driver.find_elements_by_link_text returns list so If I send click event it wont understand.

Solution 2

maybe driver.find_elements_by_link_text("MISCQA Misc Tests")[0].click() or another index…

I don’t know Selenium, but I guess find_elements_by_link_text is finding more than one thing, or maybe the method always return a list rather than a single object. If you are absolutely sure that only one object should be the result of your search, than just use [0] as I mentioned, if you can’t assume that there will be only one object, than you need to come up with a stronger strategy

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read