Search code examples
xpathelementhtmlunitaddressing

How to get text after an element in xpath?


I have the following code and I am trying to address or read "HERE", using xpath.I am programming java and using page.getFirstByXPath method:

...
 <label item = "aaa">
  <input class = "bbb"/>
  <span class = "ccc">
  <span/>
  HERE
 <label/>
...

Cheers


Solution

  • Try this

    driver.findElement(By.xpath("//label[@item='aaa']")).getText();