-
What are you trying to achieve? (Expected behavior)Attribute "innerText/innerHTML" of an element (td) should not be empty (in Firefox). What do you get instead? (Actual behavior)In Chrome I get the correct string of an element attribute (innerText). In Firefox the string is always empty. How could the issue be reproduced? (Steps to reproduce)In a PHP test I try to get the content of an element (td): $column->getAttribute('innerText'); Details
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
To get text value of an element, you can use native WebDriver method $innerHtml = $driver->findElement($element)->getDomProperty('innerHTML'); Alternatively, you can ale use $innerHtml = $driver->executeScript('return arguments[0].innerHtml', $element) |
Beta Was this translation helpful? Give feedback.
-
Hi, I was wondering why you get different values with "innerText" (empty, not empty) in Chrome and Firefox. With $element->getText it works, |
Beta Was this translation helpful? Give feedback.
To get text value of an element, you can use native WebDriver method
$element->getText()
.To get JavaScript property like
innerHTML
orchildElementCount
etc., usegetDomProperty()
method (see example below).getAttribute()
could be used only to get value of DOM element attribute (like "class", "id", "style" etc.) .See wiki
Alternatively, you can ale use
executeScript()
to get the same result: