-2

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!

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
David
  • 5
  • 6

3 Answers3

0

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");
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
0

Looks like id is dynamic. You can try to use the phrase in data content for searching:

findElement(By.xpath(".//img[@data-content = "your text"])).getAttribute("data-content");

If you need to get text and validate it (e.g. text inside of data content can be different), you can search by class:

driver.findElement(By.className("smarty-tip-wrapper")).getAttribute("data-content");
Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
0

Maybe the problem is everything is included in the table? if i think well

click to see

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
David
  • 5
  • 6