Wait
Wait

Reputation: 1

How to get the value printed when it is under react text in selenium?

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.

Upvotes: 0

Views: 595

Answers (1)

Rain9333
Rain9333

Reputation: 570

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.

Upvotes: 0

Related Questions