Search code examples
javaseleniumselenium-chromedriverchrome-web-driver

WebDriver get text


I use WebDriver and ChromeDriver. How i can fetch text from this speech bubble:

[click to see picture 1]

And code this speech bubble from website:

click to see picture 2

Thank you for your help!


Solution

  • Use xpath to get it

     //img[@data-id='c085ede491334747f26718fc2e8009e3')]
    

    You can use this code and try:

    driver.findElement(By.xpath("//img[@data-id='c085ede491334747f26718fc2e8009e3')]")).getAttribute("data-content");