量角器不使用chromedriver 2.30

时间:2017-07-21 18:32:30

标签: javascript angular jasmine protractor e2e-testing

编辑:我的Chrome驱动程序是最新的,但我的Chrome浏览器不是。解决方案是降级Chrome驱动程序(不幸的是,升级Chrome不适合我。

  

webdriver-manager更新versions.chrome 2.24 //获取exe

     

webdriver-manager启动versions.chrome 2.24 //运行正确的exe

请在此处查看解决方案来源:https://stackoverflow.com/a/39542803/2954463

也非常感谢Barney的评论。

我需要帮助让我的Protractor启动并运行。我试图在protractor.org的主页上重现todo-spec示例,但我得到一个例外,即Chrome版本必须> = 58。

但根据Google,我的日志中的chromedriver 2.30 支持Chrome 58!

我做错了什么?请注意,我在没有管理员权限的Windows环境中运行。

我在其他终端中运行webdriver

  

C:\代码\我的项目> webdriver-manager start

我有一个裸骨的量角器配置

conf.js

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js']
};

我的规范直接从protractor.org的主页复制

待办事项-spec.js

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

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

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

    // You wrote your first test, cross it off the list
    todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(completedAmount.count()).toEqual(2);
  });
});
  

C:\代码\我的项目>量角器conf.js

c:/code/my-project>protractor conf.js
[14:33:00] I/launcher - Running 1 instances of WebDriver
[14:33:00] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[14:33:03] E/launcher - session not created exception: Chrome version must be >= 58.0.3029.0
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The ser
ver did not provide any stacktrace information)
Command duration or timeout: 1.98 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'LFGTZL12', ip: '10.47.203.127', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102'
Driver info: driver.version: ChromeDriver
[14:33:03] E/launcher - SessionNotCreatedError: session not created exception: Chrome version must be >= 58.0.3029.0
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The ser
ver did not provide any stacktrace information)
Command duration or timeout: 1.98 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'LFGTZL12', ip: '10.47.203.127', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102'
Driver info: driver.version: ChromeDriver
    at WebDriverError (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:27:5)
    at SessionNotCreatedError (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:214:5
)
    at Object.checkLegacyResponse (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:5
05:15)
    at parseHttpResponse (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:440:13)
    at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:7
77:24)
    at Function.createSession (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:709:29)
    at createDriver (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:167:33)
    at Builder.build (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:623:16)
    at Hosted.getNewDriver (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\driverProvider.ts:60:29)
    at Runner.createBrowser (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\lib\runner.ts:225:39)
    at q.then.then (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\lib\runner.ts:391:27)
    at _fulfilled (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\james\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
[14:33:03] E/launcher - Process exited with error code 199

c:/code/my-project>

0 个答案:

没有答案