My goal is to extract a number from a specific div element during the execution of my test cases. I am able to locate the element, but I am struggling to retrieve the number and print it to the console.
This is what I have tried:
WebElement webelement = driver.findElement(By.xpath("//div[contains(@class,'responsive now') and text()='Application number']"));
webelement.getText();
and
driver.findElement(By.xpath("//div[@class='responsive-show']")).getAttribute("value");
While there are no issues with the locators, the number is not being displayed.
<td>
<div class="responsive-show">Application number</div>
"3204255"
<input data val="true" data-val-number="The field ExaminationNumber must be a number." data-val-required="The ExaminationNumber field is required." id="ActiveExamModeIs_0__ExaminationNumber" name="ActiveExamMode[0].ExaminationNumber" type="hidden" value="3204255">
<input data -val="true" data-val-number="The field ExaminationEligibilityExamTypeId must be a number" data-val-required="The ExaminationEligibilityExamTypeId fiels is required." type="hidden" value="1">
</td>