dimanche 4 janvier 2015

protractor: test for focus of field

How can I test if an input field is infocus with protractor? I'm doing this:



it('should focus email field', function(){
expect(element(by.model('login.email')).getAttribute('id')).toEqual(browser.driver.switchTo().activeElement().getAttribute('id'));
});


This seems to work with chrome, but this test fails with firefox. Any ideas?


This is the failure message:



[firefox #1] 2) Login page should focus email field
[firefox #1] Message:
[firefox #1] Expected 'login' to equal ''.
[firefox #1] Stacktrace:
[firefox #1] Error: Failed expectation
[firefox #1] at [object Object].<anonymous> (/Users/JasonKu/Desktop/jku/test/e2e/login-spec.js:38:69)
[firefox #1]

Aucun commentaire:

Enregistrer un commentaire