Reputation: 581
I'm having trouble clicking on people's names within whatsapp.
The error is:
TypeError: 'WebElement' object is not callable
.
My code:
person = 'Tom'
click = driver.find_element_by_xpath(f'//span[contains(@title,"{person}")]')
click()
I also tried
click = driver.find_element_by_xpath(f'//span[contains(@title,"{person}")]/parent::*')
Upvotes: 0
Views: 90
Reputation: 3717
The syntax click()
won't work because click
is a webElement, not a function. It should be like
element = driver.find_element_by_xpath(f'//span[contains(@title,"{person}")]')
element.click()
Upvotes: 2