Bryn Wolfe
Bryn Wolfe

Reputation: 183

Getting text of a span that is not displayed

The web page I'm testing has a span with inner HTML having a numeric value that I want to extract. For example:

<span class="timeout" style="display:none">5000</span>

I tried using the nightwatch command getText(), but it only returns "displayable" text, which, in this case, is a null string. What is the proper way to access this data?

Upvotes: 1

Views: 697

Answers (1)

Bryn Wolfe
Bryn Wolfe

Reputation: 183

Figured it out myself. You can use getAttribute on "innerHTML" to get the value, e.g.,

browser.getAttribute(spanCSS,"innerHTML",function(r)
{   console.log("span's innerHTML is " + r.value)
})

Wonder if there is a list of these "reserved" attribute names somewhere.

Upvotes: 2

Related Questions