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.

Actions doesn't work with SELENIUM_PROMISE_MANAGER

See original GitHub issue

Bug report

The action builder doesn’t execute/wait the action chain in the correct order if SELENIUM_PROMISE_MANAGER is set to false.

  • Node Version: 10.1.0
  • Protractor Version: 5.4.2
  • Angular Version: 7.0.0
  • Browser(s): Chrome
  • Operating System and Version Windows 10
  • Your protractor configuration file
exports.config = {
  allScriptsTimeout: 50000,
  specs: [
    './src/*spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: '',
  framework: 'jasmine',
  SELENIUM_PROMISE_MANAGER: false,
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: require('path').join(__dirname, './tsconfig.json')
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};
  • A relevant example test
describe('angular homepage', function() {
      it('Should navigate with action builder', async function() {
        await browser.manage().window().maximize()
        await browser.get('https://angular.io/docs')
        await browser.actions()
                      .mouseMove($('button[title="The fundamentals of Angular"]'))
                      .click()
                      .mouseMove($('button[title="The basic building blocks of Angular applications."]'))
                      .click()
                      .mouseMove($('a[title="Beyond the basics."]'))
                      .click()
                      .perform();
        await browser.sleep(5000);
      });
  });
  • Output from running the test N/A
  • Steps to reproduce the bug Run the test with SELENIUM_PROMISE_MANAGER = false and true and check the difference
  • The URL you are running your tests against (if relevant) N/A

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cnishinacommented, Mar 5, 2019

I think mouseMove takes a WebElement and not an ElementFinder. This might have worked via the magic of the control flow.

So maybe:

await browser.actions()
  .mouseMove(await $('button[title="The fundamentals of Angular"]').getWebElement())
  .click()
0reactions
cnishinacommented, Mar 9, 2019

This is actually probably a complicated fix. Currently we expose actions() from selenium-webdriver. If you wanted it to take an ElementFinder, you would have to implement the entire Actions / ActionSequence API and check if it is an ElementFinder or a WebElement and convert ElementFinders to WebElements then pass it the Actions / ActionSequence API.

I think understanding that sometimes Protractor outputs and exposes the underlying library is important. I am not sure if it is currently worth fixing. I’m going to close this issue since it looks resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

async await in Protractor is ignored - Stack Overflow
I have set protractor.promise.USE_PROMISE_MANAGER = false ; to be able to use async await . When I set the selenium promise manager to...
Read more >
Selenium promise manager not working #115 - GitHub
It seem that promise manager not work. I try to set SELENIUM_PROMISE_MANAGER = true, or process.env.SELENIUM_PROMISE_MANAGER = 1, but still ...
Read more >
JavaScript async/await in Selenium WebDriver Tests - Applitools
It seems that the Selenium community understands that the scam that is this synchronous/asynchronous mode should be temporary: The promise ...
Read more >
What is Promise in Protractor? - Tools QA
In this article, we will discuss What is Promise in Protractor Angular Automation? All the Protractor API methods return promise objects.
Read more >
WebDriver in JavaScript with Promises
WebDriverJS provides a Promise Manager that helps with the scheduling and execution of all promises automatically. Specifically, WebDriverJS has ...
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