protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Right click is not performed on Chrome v75. Instead a left click action is performed.

Open alexcergau opened this issue 7 years ago • 5 comments

Bug report

I have some tests trying to simulate a right click as follows:

  browser.actions().mouseMove($('#id')).perform();
  browser.actions().click(protractor.Button.RIGHT).perform();

It worked fine on following configuration:

Chrome V74 ChromeDriver V74 selenium-server-standalone-3.141.59.jar "@types/node": "^12.0.10", "jasmine": "^3.4.0", "protractor": "^5.4.2", "typescript": "^3.5.2", "webdriver-manager": "^12.1.5"

After updating Chrome and ChromeDriver to V75 right click is no longer performed. A left click is performed instead.

I found following workaround: If I set 'directConnect' property to true the right click is performed. Using directConnect is not an option since we also want to run tests on IE.

  • Node Version: 12.0.10
  • Protractor Version: 5.4.2
  • Browser(s): Chrome 75
  • Operating System and Version Windows 10
  • Protractor configuration file
exports.config = {
    // launch locally when fields directConnect and seleniumAddress are not provided
    //directConnect: true,
    chromeDriver: 'C:\\source\\protractorProj\\drivers\\chromedriver.exe',
    seleniumServerJar: 'C:\\source\\protractorProj\\drivers\\selenium-server-standalone-3.141.59.jar',
    specs: ['C:\\source\\protractorProj\\specs\\tests.js'],
    capabilities: {
      browserName: 'chrome'
    }
  }
  • A relevant example test
   import {browser, $, protractor} from 'protractor'

  describe('Protractor Typescript Demo', function() {
	it('title verifications', function() {
	  browser.get('https://talis.github.io/ng-context-menu/#/');
	  browser.sleep(3000);browser.actions().mouseMove($('#panel-0 .panel-body')).perform();
          browser.actions().click(protractor.Button.RIGHT).perform();
          browser.sleep(5000);

          browser.actions().mouseMove($('a')).perform();
          browser.actions().click(protractor.Button.RIGHT).perform();
          browser.sleep(2000);
	});
});

I run the test with following command: "protractor conf.js"

Request

I would expect that the right click is performed as in previous versions.

I also did a test in Java using Selenium and the right click was done correctly both on Chrome 74 and 75 by using these lines of code WebElement elementLocator = driver.findElement(By.id("ID")); actions.contextClick(elementLocator).perform();

So I suppose there is something related to the way protractor sends the right click event and the way chromedriver handles it

alexcergau avatar Jul 02 '19 12:07 alexcergau

I'm experiencing the same problem with webdriverio, so I'd suspect the problem to be somewhere in Selenium/Chromedriver.

raketenolli avatar Jul 22 '19 09:07 raketenolli

Hi @raketenolli ,@alexcergu,

Chrome 74 uses few legacy API like sendKeysToActiveElement etc and those are now deprecated in chrome 75. To make your tests work with keyboard actions, you may have to try in this way

driver.findElement(By.cssSelector("[name="q"]")).click(Keys.ENTER);

Thanks,

harsha509 avatar Jul 30 '19 17:07 harsha509

I have the same issue. It's weird but "directConnect: true," fix this issue. Never the less this is not acceptable for me ((

Leeron2010 avatar Aug 13 '19 15:08 Leeron2010

Hi @alexcergau, @raketenolli

enabling the below capability enables chrome 74+ to use legacy API. Please try it works.

'goog:chromeOptions': { w3c: false }

Thanks !

harsha509 avatar Aug 17 '19 17:08 harsha509

The solution from previous comment works for me. But I think it's just a workaround. So we need some permanent fix. Like how to do the right click with Protractor, that will work.

aozolin avatar Oct 16 '19 11:10 aozolin