Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getText() returns a blank in Selenium even if the text is not hidden. I also tried JavaScript

I am trying to match the text and select the check box. I am trying to get the text or the innerHTML from the input tag of type checkbox.

I tried getText(); it returns blank, innerHTML, innerText returns null.

I am able to fetch the value, and all the other associated attributes of the tag, but not the text. I tried getting the text by executing the JavaScript code through Selenium, but that is also returning null or blank. How can I fix this?

The text is visible - not hidden.

like image 540
vchande Avatar asked Dec 02 '22 20:12

vchande


1 Answers

You could try using getAttribute("textContent") or getAttribute("value")

like image 104
Brian Gleeson - IBM Avatar answered Dec 10 '22 12:12

Brian Gleeson - IBM