Selenium (Java) Get FULL text from shortened displayed on page
You wanted to use getText()
method, but getText()
will be helpfull while we want to retrieve the innerHTML
only. But if we use getAttribute()
method, we will be able to pull out any of the attributes
of the WebElement
.
Now, to retrieve the full text of href
attribute you can use the following line of code :
System.out.println(driver.findElement(By.xpath("//a[contains(@href,'example.com/es_es/spain/legal-notice')]")).getAttribute("href"));