简体   繁体   中英

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.

可能不是最好的解决方案,但是用react有点困难-因此,我建议从selenium驱动程序获取页面源,然后使用一些正则表达式提取所需的内容(例如char和span元素之间的组)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM