Владимир
Владимир

Reputation: 34

Python Selenium, find text in span

I'm trying to find text on the page. Python code using Selenium:

driver.find_element_by_xpath("//span[@ng-bind=''@' + user.username']")

The text I need "@bassale" is on the page:

enter image description here

When executing the code, I get an error:

selenium.common.exceptions.InvalidSelectorException: Message: {"errorMessage":"Unable to locate an element with the xpath expression //span[@ng-bind=''@' + user.username'] because of the following error:\nError: INVALID_EXPRESSION_ERR: DOM XPath Exception 51

Help me find this text on the page.

Upvotes: 2

Views: 768

Answers (1)

miczza
miczza

Reputation: 165

Try with something like this:

driver.find_element_by_xpath("//span[@ng-bind=\"'@' + user.username\"]")

Upvotes: 2

Related Questions