protractor icon indicating copy to clipboard operation
protractor copied to clipboard

sendKeys(protractor.Key.TAB) has no effect

Open tempoc opened this issue 11 years ago • 21 comments

A test that tabs through form fields and routinely works suddenly ceased to do so in the past couple of days. The relevant source:

beforeEach(function () {
    firstLabel.click();
    firstField.click();
});

it("should become invisible when tabbed out", function () {
    firstField.sendKeys(protractor.Key.TAB);

    expect(firstField.isDisplayed()).toBeFalsy();
});

protractor.Key.TAB is defined and in the console prints out the equivalent of '\uE004'

The test is running on the latest version of Chrome. Some of the npm devDependencies are:

[email protected] node_modules/gulp-protractor
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

And output from jar updates reads:

Updating selenium standalone
downloading https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar...
Updating chromedriver
downloading https://chromedriver.storage.googleapis.com/2.15/chromedriver_mac32.zip...
chromedriver_2.15.zip downloaded to [path]/node_modules/gulp-protractor/node_modules/protractor/selenium/chromedriver_2.15.zip
selenium-server-standalone-2.45.0.jar downloaded to [path]/node_modules/gulp-protractor/node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar

tempoc avatar Jul 22 '15 20:07 tempoc

More info: This works in Firefox but not in Chrome

describe('Test', function () {
  it('should browse to google', function () {
    browser.ignoreSynchronization = true;
    browser.driver.get('https://www.google.de');
    expect(browser.getCurrentUrl()).toEqual('https://www.google.de/');
  });
  it('should unfocus the search field', function () {
    var search = element(by.name('q'));
    search.sendKeys(protractor.Key.TAB);
    browser.sleep(3000); // 3s to take a look ;)
  });
});

Credit: http://stackoverflow.com/questions/28410273/how-to-send-keyboard-keys-in-protractor-like-tab

tempoc avatar Jul 22 '15 21:07 tempoc

Can confirm we're also having this issue. It doesn't seem to work using action sequence either:

browser.actions().sendKeys(protractor.Key.TAB).perform()

unkillbob avatar Jul 23 '15 21:07 unkillbob

I see the problem in FF but not in Chrome.

On Thu, Jul 23, 2015 at 5:52 PM, James Bunt [email protected] wrote:

Can confirm we're also having this issue. It doesn't seem to work using action sequence either:

browser.actions().sendKeys(protractor.Key.TAB).perform()

— Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/2370#issuecomment-124249246 .

jlin412 avatar Jul 23 '15 22:07 jlin412

just out of curiosity - can you try to detect a blur() instead of tabbing out?

jschlot avatar Jul 23 '15 23:07 jschlot

+1 also having this issue, and notably have not updated protractor either. It seems this is either a chrome update or a webdriver update of some kind.

ashaffer avatar Jul 24 '15 01:07 ashaffer

I got the same problem and this was working couple days ago, I believe as well that it's the Chrome update that is now causing this issue.

My Chrome version is Version 44.0.2403.89 m (64-bit)

ghiscoding avatar Jul 24 '15 03:07 ghiscoding

I've also just experienced this issue.

CharlieTruong avatar Jul 24 '15 03:07 CharlieTruong

I have the same problem with Protractor 2.1.0. With update to chrome version 44.0.2403.89 m WebElement.sendKeys(protractor.Key.UP) will not work anymore.

Seems to be an issue not only with protracotr:

https://code.google.com/p/chromedriver/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Pri%20Owner%20Summary&groupby=&sort=&id=1159

hirtenfelder avatar Jul 24 '15 12:07 hirtenfelder

with elementExplorer:

browser.ignoreSynchronization = true
browser.get('https://github.com/angular/protractor/issues/new')
//this works:
element(by.name('q')).sendKeys('derp');
//this works:
element(by.name('q')).sendKeys(protractor.Key.BACK_SPACE)
//this doesn't:
element(by.name('q')).sendKeys(protractor.Key.TAB)

Is this not how you're supposed to get protractor to tab away from elements? It used to work: http://stackoverflow.com/questions/28410273/how-to-send-keyboard-keys-in-protractor-like-tab but my tests started failing this week after updating webdriver.

( Celebrate the little victories - good job me for not creating a duplicate issue 🙌 )

andrew-luhring avatar Jul 24 '15 20:07 andrew-luhring

Oh, we experience the issue as well, it breaks our tests! :( Do you have a workaround for this? Downgrading for old versions of protractor didn't help...

virtser avatar Jul 26 '15 12:07 virtser

Breaking tests here too :/

CThuleHansen avatar Jul 29 '15 11:07 CThuleHansen

Breaking my tests as well.

aaronpmishkin avatar Jul 30 '15 20:07 aaronpmishkin

Same here, tests are broken on Chrome 44.

abhishekswain avatar Jul 31 '15 06:07 abhishekswain

This is now fixed in the latest version of Chrome! Finally.

ashaffer avatar Aug 04 '15 19:08 ashaffer

Thank you for heads up @ashaffer

CThuleHansen avatar Aug 05 '15 06:08 CThuleHansen

Fixed with https://code.google.com/p/chromium/issues/detail?id=513768

tempoc avatar Aug 17 '15 16:08 tempoc

Again broken in chrome version 53 with protractor version 4.0.0 [also with 4.0.9]. Was working wit 52nd version of chrome. Does other also face the same problem?

Satbeen avatar Sep 24 '16 16:09 Satbeen

yes, I got the same problem

calystoramesh avatar Sep 26 '16 09:09 calystoramesh

Same problem with Protractor 4.0.9 and Chrome 53.0.2785.116 m (64-bit).

jfranki avatar Sep 28 '16 10:09 jfranki

I am on Chrome Version 53.0.2785.143 m and see the same problem. Has somebody opened an issue for this on Chrome yet?

Narretz avatar Oct 04 '16 16:10 Narretz