GetText returns null | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
10% June Month Discount Avail now

Selenium Training Forum

getText returns null

V
Valerie Kollmann Post on 05/04/2019

Hello,

I am using Selenium Webdriver with Java and the Chrome browser. I am trying to get the text for Product Description. I have tried getText() and getAttribute and both are returning null. The screenshot shows the text I am trying to get, along with the HTML code. Can someone please tell me why this doesn't work?

 

Thank you.

 

D

Instructor

Demo Reply on 09/04/2019

make sure that the locator you're using is correct. It may be the reason

V
Valerie Kollmann Reply on 09/04/2019

I've tried all the locators below and getText did not work. Even when using the absolute xpath, getText did not work. The cursor moves to the correct location so the locator is correct. Do you know why getText is not able to extract the text?

 

D

Instructor

Demo Reply on 10/04/2019

Please share the project so that we can analyze the issue.