0

Operator .text() is interpreting/eliminating the following inclusions:

  1. Sequenced space characters
  2. Character entities like &nbsp
  3. In-line references like a href="http://www.youtube.com/watch?v=..." target="_blank"

How I can read text block between

<p> ... </p>

without any interpretation?

Le Ma
  • 67
  • 6

1 Answers1

1

This is unfortunatelly not possible. Geb is using WebDriver's WebElement.getText() method under the hood and WebDriver's philosophy when it comes to text is to only return text that would be visible to a human and exactly as it is displayed.

erdi
  • 6,944
  • 18
  • 28
  • Thank you, erdi! Please advise is it possible to get raw access data to get exactly HTML produced by the sever in this block? Seems to be quite useful to have both - interpreted and non-interpreted access to receive data from the page... – Le Ma Oct 01 '14 at 09:35
  • 2
    Apparently [getting the value of `innerHtml` attribute of a `WebElement` returns the HTML of that element](http://stackoverflow.com/a/8575709/1856764). This can be used in Geb in the following way: `$("#my-element').getAttribute("innerHtml")` or in a more concise form: `$("#my-element').@innerHtml` – erdi Oct 01 '14 at 12:12