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.

Only first page elements can be found with selectors in Ionic 3

See original GitHub issue

Bug report Hi!

In Ionic3, I can normally find the HTML elements with ‘$’ selector like: $('#start-game'), but when I start the game, which leads me to the next Page (executed with nav.setRoot or nav.push), then it doesn’t find me any HTML elements anymore, but I get the error instead (provided below).

I already tried to set some browser.wait on hundred ways but nothing helps.

  • Node Version: 6.10.2
  • Protractor Version: 5.1.2
  • Angular Version: 4.1.0
  • Browser(s): Chrome
  • Operating System and Version Win 10
  • Your protractor configuration file: https://pastebin.com/1g7j4Ekf
  • A relevant example test const goalWrapper = $('#goal-wrapper'); const until = protractor.ExpectedConditions; browser.wait(until.presenceOf(goalWrapper), 5000, 'Element taking too long to appear in the DOM'); $('#goal-wrapper').getSize().then((size) => { // this is not executed! console.log(size); });
  • Output from running the test - Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular While waiting for element with locator - Locator: By(css selector, .level-complete-wrapper)
  • Steps to reproduce the bug: Try the code above.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wswebcreationcommented, Oct 5, 2017

Ok,

I’m going to close this issue for now. It’s still open for discussion.

1reaction
sasos90commented, Oct 5, 2017

I see, it was too late to think clearly 😄 The thing is that I had more examples but they were calling the same thing “getSize”, so I can simply change the selector. Let’s say thisi is now relevant test example:

const levelCompletedWrapper = $('.level-completed-wrapper');
const until = protractor.ExpectedConditions;
browser.wait(until.presenceOf(levelCompletedWrapper), 5000, 'Element taking too long to appear in the DOM');
$('.level-completed-wrapper').getSize().then((size) => { // this is not executed! console.log(size); });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic Demo: UI Components & API Customization to Create ...
If your page has an <ion-navbar> , a back button will automatically be added to it if it is not a root page,...
Read more >
ionic 5 component selector is not applied to html element
It is inserted as one of the top level html elements on the page, so it can be used in the css styles...
Read more >
Using Custom Components on Multiple Pages in Ionic
In this tutorial, we take a look at some common pitfalls when using custom components and how you can use custom components across...
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
Default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll ...
Read more >
The 30 CSS Selectors You Must Memorize - Code
This snippet is an abstraction that will find all paragraphs on the page, and then sub-target only the first letter of that element....
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