Get some text with java + selenium WebDriver

后端 未结 4 1566
深忆病人
深忆病人 2020-12-12 02:08

I want to get only the text \"Invitation sent to xxxxx\", I do not want to get what\'s inside the

4条回答
  •  清歌不尽
    2020-12-12 02:25

    Given the HTML, you should be able to .getText(), split that text on a newline, and then take the first split to get the text you want.

    driver.findElement(By.cssSelector("p.artdeco-toast-message")).getText().split("\r\n")[0];
    

提交回复
热议问题