简体   繁体   中英

Delay after downloading a file in Protractor test

My test downloads a file and then clicks a button. The click on the button takes effect (opening a sidebar) 40 secs after. If I disable the downloading code in the app (making the bottom download bar not to appear), the sidebar opens right away without delay.

My question is roughly the same as this one . The question has no solution and is quite old, that's why I ask again.

What I have tried:

  • reduce timeout with browser.manage().timeouts().implicitlyWait(100);
  • browser.ignoreSynchronization = true; before downloading (and browser.ignoreSynchronization = false; after)
  • await browser.waitForAngularEnabled(false); before downloading (and await browser.waitForAngularEnabled(true); after)
  • browser.executeScript('window.stop();'); after downloading
  • const wins = await browser.driver.getAllWindowHandles(); await browser.switchTo().window(wins[0]); after downloading
  • await browser.switchTo().activeElement(); after downloading
  • const bd = element(by.css("body")); await browser.actions().mouseMove(bd, { x: 0, y: 0 }).click().perform(); after downloading
  • browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); after downloading
  • let ChromeDriver use a Chrome extension to disable bottom download bar (such as this one )

I don't know what is happening, that's why I tried various (and maybe unrelated with the cause) things.

Thank you.

After searching and trying various things, solved with

browser.controlFlow().execute(function () {
    browser.ignoreSynchronization = false;
});

before downloading and

  browser.controlFlow().execute(function () {
        browser.ignoreSynchronization = true;
    });

after.

Can anybody explain me why?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM