Skip to content
Advertisement

Selenium element.text() is not considered as a string

Im trying to get an element name with python selenium and print it later but it throws following error:

JavaScript

Code line looks like this:

JavaScript

HTML element looks like this:

JavaScript

I tried searcing for element by XPath but it seems not to be a reason for error…

Advertisement

Answer

To get a web element text you should apply .text on it, not .text()
Also, there are unnecessary parenthesis here that should be removed.
So, instead of

JavaScript

it should be

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement