Himanshu Varshney Himanshu Varshney - 6 months ago 60
Java Question

getText() returning blank



<div class="header"> Account</div>
<div class="header"> Email</div>
<div class="value ng-binding">$50</div>==$0





Above is the HTML snippet, i am trying to fetch text: $50, with getText().To locate the element i have used className and xpath.

The problem that i am facing is that, Selenium is able to locate the element but return blank,in place of $50.

Answer

You should instead try using .getAttribute("innerHTML"); on the ClassName to return $50.