1

I am trying to find and click with selenium on python a little plus-button but for any reason I a get a TypeError

TypeError: 'str' object is not callable

This is the link https://meshb.nlm.nih.gov/treeView and I try to find and click the following codesnippet from the html.

<i id="plus_Anatomy" onclick="openTree(this)" class="fa fa-plus-circle treeCollapseExpand fakeLink"></i>

This is my python code so far. At first it looks like everything should work. So browser windows opens and the webpage is loaded, but then I get this error mentioned above.

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://meshb.nlm.nih.gov/treeView")
plus = driver.find_element(By.CLASS_NAME('fakeLink'))
driver.execute_script("arguments[0].click();", plus)

The bigger goal is to click on all the buttons and scrap the complete html in the end. can anybody please help me? What am I doing wrong?

1 Answer 1

2

You have a syntax error.
Instead of

plus = driver.find_element(By.CLASS_NAME('fakeLink'))

Try

plus = driver.find_element(By.CLASS_NAME, 'fakeLink')

Or even

driver.find_element(By.CLASS_NAME, 'fakeLink').click()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.