Using Firefox 35 with protractor results into an e

2020-02-01 03:19发布

问题:

Run my Angular app scenarios with chrome the scenarios are run successfully, but the halt is occurred at firefox new version 35.0b6. Any one please help me thanks in advance.

I'm using protractor 1.4.0. My scenario:

describe('99ccs e2e testing', function() {
    it('check it have a title 99CCS', function() {
        browser.get('http://99ccs.com/ccsnew/#/login');

        //it checks the "http://99ccs.com/ccsnew/" page contains a title "99CCS"
        expect(browser.getTitle()).toEqual('99CCS');

        //it checks when user enter the URL as "http://99ccs.com/ccsnew/" it navigates to "http://99ccs.com/ccsnew/#/login"
        browser.get('http://99ccs.com/ccsnew/');
        expect(browser.getLocationAbsUrl()).toBe('http://99ccs.com/ccsnew/#/login');

        //it checks when user enter the URL as "http://99ccs.com/ccsnew/" it navigates to Login page or not
        browser.getLocationAbsUrl().then(function(url) {
            expect(url.split('#')[1]).toBe('/login');
        });
        expect(browser.get('http://99ccs.com/ccsnew/')).toEqual(browser.get('http://99ccs.com/ccsnew/#/login'));

        //it checks if we give any location url from 99ccs.com/ccsnew without login it navigates to Login page or not
         expect(browser.get('http://99ccs.com/ccsnew/#/ts/edit/131')).toEqual(browser.get('http://99ccs.com/ccsnew/#/login'));
    });
});

回答1:

Selenium 2.44 is not compatible with Firefox 35. Related issues:

  • Heads up: Protractor is not working with Firefox 35
  • FirefoxDriver fails to execute async script with FireFox 35
  • Firefox 35: Passing arguments to executeScript isn't working.

The easiest option right now would be to downgrade firefox to the latest stable version (currently 34.0.5).

UPDATE: selenium 2.45 with firefox compatibility issues fixed was released today (Feb 28 2015). At the moment, to have protractor work with selenium 2.45 - install it from the protractor github master branch directly:

$ npm install angular/protractor

or

$ npm install git+https://git@github.com/angular/protractor.git

FYI, I've reproduced the same connection problems with protractor 1.5 and the "angularjs.org" protractor tutorial test case:

describe('angularjs homepage todo list', function() {
    it('should add a todo', function() {
        browser.get('http://www.angularjs.org');

        element(by.model('todoText')).sendKeys('write a protractor test');
        element(by.css('[value="add"]')).click();

        var todoList = element.all(by.repeater('todo in todos'));
        expect(todoList.count()).toEqual(3);
        expect(todoList.get(2).getText()).toEqual('write a protractor test');
    });
});