question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

content with display: none is still captured (does not match innerText)

See original GitHub issue

The PageObject.text helper returns hidden text. While — by comparison — innerText does not.

Given

<span id="example">
  <span>foo</span>
  <span style="display: none">bar</span>
  <span>baz</span>
</span>
const page = PageObject.create({
  example: PageObject.text('#example')
});

Expected

find('#example').innerText.trim() // => "foo baz"
page.example                      // => "foo baz"

Actual

find('#example').innerText.trim() // => "foo baz"
page.example                      // => "foo bar baz"

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ro0grcommented, Oct 3, 2021

@Alonski would be glad to accept a PR

1reaction
ro0grcommented, Jan 20, 2021

oh… I’ve just faced the issue when upgraded ec-page-object in a lib from 1.16 to 1.17. This seems to be a regression introduced in https://github.com/san650/ember-cli-page-object/pull/466

I believe we should revert contains to keep using $.text() instead of .innerText

Read more comments on GitHub >

github_iconTop Results From Across the Web

Div innerText loses new lines after setting display to none
I believe the issue is that there are no newlines, just new block -level children of the div with inner text nodes containing...
Read more >
The poor, misunderstood innerText
They don't include hidden elements ("display:none", "visibility:hidden"), which makes sense too. And they don't include contents of <select> ...
Read more >
Element selectors | Playwright 中文文档
Selectors are strings that point to the elements in the page. They are used to perform actions on those elements by means of...
Read more >
<input type="text"> - HTML: HyperText Markup Language | MDN
If no validation constraints are in place for the input (see ... This must be a non-negative integer value smaller than or equal...
Read more >
Using Cypress
How do I get an element's text contents? Cypress commands yield jQuery objects, so you can call methods on them. If you're trying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found