0
votes

Please find the attached screenshot for html tags:We need to print the 3 which in react-text

The following code i have tried: WebElement MyText = driver.findElement(By.xpath("(//div[@class='badge-number'])[6]"));

JavascriptExecutor jse = (JavascriptExecutor)driver;

String platformName = (String) jse.executeScript("return arguments[0].value;", MyText); System.out.println("text:"+MyText.getText());

I just want to print that minutes and seconds and they are dynamic.

1
<div class="badge-number"> <!-- react-text: 659 --> "3" <!-- /react-text: 659 --> <span class="badge-small-text hour">Minutes</span> <!-- react-text: 660 --> "12" <!-- /react-text: 660 --> <span class="badge-small-text hour">Seconds</span> </div> - Wait

1 Answers

0
votes

Might not be the best solution but with react is kind a hard - so I can suggest getting the page source from the selenium driver then use some regex to extract what you need (like groups between the " char and also between the span elements.