Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
874 views
in Technique[技术] by (71.8m points)

selenium webdriver - session not created exception for chrome in Protractor

I get below error when try to run Protractor test against chrome.

My conf.ts

import {Config} from 'protractor'

export let config: Config = {
    framework: 'jasmine',
    // capabilities: { browserName: 'chrome'},
    multiCapabilities: [
        // {browserName: 'firefox'},
        {
            browserName: 'chrome',
            chromeOptions: {
                args: ['--start-maximized']
            },

        }],

    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
    seleniumPort: null,
    seleniumArgs: [],
    specs: [
        './Protractor/Login/*.spec.js',

Error:

Protractor conf.js
[17:19:07] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[17:19:07] I/launcher - Running 1 instances of WebDriver
[17:19:09] E/launcher - session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"8800.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.59)
  (Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.07 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'MAL000009416062', ip: '192.168.1.4', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_73'
Driver info: org.openqa.selenium.chrome.ChromeDriver
[17:19:09] E/launcher - SessionNotCreatedError: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"8800.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.59)
  (Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.07 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'MAL000009416062', ip: '192.168.1.4', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_73'
Driver info: org.openqa.selenium.chrome.ChromeDriver
    at WebDriverError (C:Users392811AppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverliberror.js:27:5)
    at SessionNotCreatedError (C:Users392811AppDataRoaming
pm
ode_modulesprotractor
ode_modulesselenium-webdriverliberror.js:308:5)

conf.ts

multiCapabilities: [

        {
            browserName: 'chrome',
            chromeOptions: {
                args: ['--start-maximized']
            },

        }],

Most of the discussion on the web is around version. I am currently using up-to-date versions

Any clue please?

Cheers

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can change the version of chromedriver downloaded by webdriver-manager by altering Protractor's config.json file...

  1. Edit Protractor's config file: node_modules/protractor/config.json
  2. Change the chrome driver version to whatever you need. eg. "chromedriver": "2.24".
  3. Run webdriver-manager update.

from the error you posted, protractor is not using the latest chrome driver version.In stack trace it is displaying chrome driver version as 2.21.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...