#StackBounty: #selenium-webdriver #protractor #webdriver-io How to get Protractor to reload the DOM without reloading the browser

Bounty: 100

How to get Protractor to reload the DOM without reloading the browser?

I have a web app that loads completely and then 5 seconds later it dynamically adds a survey to the page and the DOM changes. My Protractor test is unable to find any of the elements on the survey popup (Qualtrics survey on Angular app), including the close button.

So, how can I get Protractor to re-read the DOM so that it knows about the survey popup?

Reloading the page or re-navigating to the same URI is NOT an option because it will reset the application and the page state is lost and the survey will disappear.

Using waitForAngularEnabled will not work because the DOM changes again after a 5-second timer.

For example, neither of these worked:

isSurveyDialog() {
  return element(by.css('div.QSIPopOver')).isPresent() as Promise<boolean>;
}

isSurveyDialog() {
  const EC = protractor.ExpectedConditions;
  return browser.wait(EC.presenceOf($('.QSIPopOver')), 10000) as Promise<boolean>;
}

Is there a lower-level "webdriver js" way to do this?

EDIT:
explanation of symptom: AFTER the page has finished loaded , a few seconds later, the HTML elements circled in RED are dynamically added to the DOM without a page refresh.
enter image description here


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.