This is the HTML of the web page:
<td class=" gridCell wrapText " style="height:27px;" headers="a15" data-post="" title="">
<div class="oflowDivM ">
<span>
<script src="webwb/pzpega_control_text_12877380907.js!!.js" type="text/javascript"/>
<span class="leftJustifyStyle" data-ctl="Text">30,980,030.0000</span>
</span>
</div>
My intention is to extract the value 30,980,030.0000 I am using the following code:
driver.findElement(By.xpath("//td/div/span/span")).getText();
However, the getText() returns an empty string. The xpath is correct as I do not get NoSuchElementException. Could you please help in identifying my mistake here?
System.out.println(driver.findElement(By.xpath("//td/div/span/span")).getAttribute("outerHTML"));. Is it printing the element you are expecting? If it does, put a breakpoint on that line, let the script run until it breaks, and then run the line... does it work now? If so, you probably need a wait in there.