How to extract dynamic text from multiple child nodes within the html through getText()

前端 未结 2 1743
轮回少年
轮回少年 2020-12-12 00:56

We have a Div containing some hard coded text and span containing some dynamic text values (refer below HTML code for more understanding). The resultant Text is: 1

2条回答
  •  生来不讨喜
    2020-12-12 01:21

    You can use the Webelement.getText() method to extract text and you can get the expected result as below

    String actual =driver.findElement(By.id("bulk_update_confirmation")).getText();
    

提交回复
热议问题