Protractor encountering a session creation exception for chrome

Encountering an error while trying to execute a Protractor test in Chrome.

Here is my conf.ts file:

import {Config} from 'protractor'

export let config: Config = {
    framework: 'jasmine',
    multiCapabilities: [
        {
            browserName: 'chrome',
            chromeOptions: {
                args: ['--start-maximized']
            },
        }],
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
    seleniumPort: null,
    seleniumArgs: [],
    specs: [
        './Protractor/Login/*.spec.js',

Error Message:

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:\Users\392811\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:27:5)
    at SessionNotCreatedError (C:\Users\392811\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:308:5)

conf.ts:

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

Seeking advice as most discussions online revolve around the version, yet I am using the latest versions available.

Any help would be greatly appreciated.

Cheers

Answer №1

To modify the version of chromedriver that is downloaded by webdriver-manager, simply adjust the config.json file within Protractor's directory...

  1. Locate and open Protractor's config file: node_modules/protractor/config.json
  2. Update the chrome driver version to the desired one. For example, change "chromedriver": "2.24".
  3. Execute webdriver-manager update to apply the changes.

Based on the error message provided, it seems that protractor is currently utilizing an outdated version of the chrome driver. The stack trace indicates that the chrome driver version being used is displayed as 2.21.

Answer №2

I have not yet gained enough reputation to comment on Sudharsan's answer, but I wanted to clarify the location of the configuration file you need to modify.

node_modules/protractor/node_modules/webdriver-manager/config.json

It's not the Protractor tsconfig file, but the webdriver-manager config.json that needs to be edited.

While Sudharsan's solution may work for a one-time installation, I encountered a recurring issue in my setup. In our TFS builds, the working directory is cleared and a fresh repository is pulled in for each build. Modifying the webdriver config directly did not resolve the problem as it always reverted to the older version of chromedriver.

Instead, I added chromedriver to my devDependencies in the package.json, deleted the webdriver-manager installed version, and moved the updated chromedriver with a gulp task. In the devDependencies section of my package.json:

"chromedriver": "~2.24.1"

Then, I used a gulp task to delete and move the files like this:

(gulp task code here)

After these steps, Protractor still looked for the old chromedriver. I had to specify the location of the chromedriver.exe in protractor conf.js to make it work.

chromeDriver: "../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver.exe",

It may seem complex, but it was necessary because chromedriver 2.22 didn't function properly with Chrome 53+. If you only need a one-time install, Sudharsan's solution is simpler. But for continuous installation like my setup, consider this alternative method.

Answer №3

All I had to do was:

npm update -g protractor
webdriver-manager update

After that, everything was back to normal.

Answer №4

Exciting news from Protractor with the latest release version 4.0.10, featuring an updated webdriver-manager (version 10.2.6) and the new Chromedriver. Simply run "webdriver-manager update" to get the latest Chromedriver. Don't forget to update the Protractor version in your package.json file by changing "protractor": "^4.0.9" to "protractor": "^4.0.10".

Stay up to date with the latest Protractor updates! :)

Answer №5

  1. To update the WebDriver, simply execute the command below:
  2. Projectdirectory:/>webdriver-manager update --versions.chrome=ChromeVersion
  3. Replace "ChromeVersion" with the version of your Google Chrome Browser. You can find the version by going to "Help>>About Google Chrome>>For Example: Version 76.0.3809.100 (Official Build) (64-bit)".

I trust this solution will resolve your issue.

Answer №6

To resolve the issue, I found that updating both chromedriver and protractor-conf.js did the trick.

  1. First, download the latest version of chromedriver that is compatible with your operating system (feel free to adjust the minor version if necessary). You can find it here: http://chromedriver.storage.googleapis.com/index.html?path=2.24/
  2. Next, extract the files to the /usr/local/bin/chromedriver directory.
  3. Then, locate the protractor-conf.js file (usually in the app's root directory) and include the line
    config.chromeDriver = '/usr/local/bin/chromedriver';

Answer №7

Make sure to locate the package.json file within your webdriver-manager directory in the users folder and update the webdriver version to the most recent one available. This adjustment should resolve the issue

"name": "webdriver-manager", "version": "15.3.2",

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When the React Native Expo app is running, the TextInput form is covered by the keyboard

When I launch the app using expo and implement my DateFormInput component, the issue of Keyboard covering TextInput arises. Despite trying packages like "@pietile-native-kit/keyboard-aware-scrollview", "@types/react-native-keyboard-spacer", "react-native-k ...

Inform the component of an error detected in the Angular service

In Angular versions prior to 8, it was possible to subscribe to both success and error Observables from the component object. This allowed the component to perform one action if the service operation completed successfully, and a different action if ther ...

Pattern matching for validating multiple email addresses

I need assistance with validating multiple email inputs using regex in Angular. I am looking to enforce a specific format for the emails, such as: Examples: *****@zigurat.com *****@test.com *****@partlastic.com The ***** can be any characters, but the ...

What is the best way to reference class variables and methods within a callback function in Typescript?

While working on my Angular project with the Highcharts API, I encountered a situation where I needed to pass a state code to a class level method after drilling down to a specific map location. Below is the snippet of my current code: ngOnInit() { this. ...

Commit to choosing an option from a dropdown menu using TypeScript

I just started learning about typescript and I have been trying to create a promise that will select options from a drop down based on text input. However, my current approach doesn't seem to be working as expected: case 'SelectFromList': ...

In Typescript, it mandates that a string value must be one of the values within the object

There is a constant declaration mentioned below: export const Actions = { VIEW: 'view', EDIT: 'edit', }; Imagine there's a function like this: // Ensuring that the action variable below is always a string with value either ...

Issues with implementing Selenium WebDriver on Chrome have caused errors to occur during the initiation and completion of running Python tests

Issues: [6944:3028:0128/220426:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED [6944:3028:0128/220426:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENT ED [6944:3028:0128/220430:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENT Upon ...

Step-by-step guide on how to stop CDK Drop depending on a certain condition

I'm trying to figure out how to disable dropping using CDK based on certain conditions. Specifically, I want the drop functionality to be disabled if the list I'm attempting to drop into is empty. I haven't been able to find a solution withi ...

`How to locate elements by ClassName and their values in Java`

HTML Code: <div class="MuiGrid-root MuiGrid-grid-xs-12 karutaNameNam css-1uqhpru">Super Heros</div> Searching for an element with the class name karutaNameNam and its text value set to "Super Heros". ...

The Angular Router is continuing to show the HomeComponent upon navigation, rather than just displaying the ChildComponent

Lately, I've been diving into Angular and attempting to create a github search application using the github api. However, I've encountered some roadblocks with routing and data passing. My goal is for the user to land on a page like /user/userID ...

Transferring data from a child component to a parent component in Vue without the need for a click

In my Vue project, I have a parent component called ChangeInfo which contains a child component named ShowWorkInfo. The ShowWorkInfo component includes several input forms for updating job information. To manage the data input, I created an object variable ...

Sorry, the element could not be located in the cache. It is possible that the page has been modified

Attempting to automate clicking the search button on Flipkart using Selenium WebDriver and Java has been successful. By utilizing X-path, the button is located and clicked. To confirm that the click action was completed, a variable 'Boolean' has ...

Managing events like onClick for custom components in Next.js and React: A Beginner's Guide

Utilizing tailwindCSS for styling and writing code in Typescript with Next.JS. A reusable "Button" component has been created to be used across the platform. When the button is pressed, I aim to update its UI in a specific way. For instance, if there&apos ...

Creating a stream of observables in RxJs and subscribing to only the latest one after a delay: A comprehensive guide

I am trying to create a stream of Observables with delay and only subscribe to the last one after a specified time. I have three HostListeners in which I want to use to achieve this. I would like to avoid using Observable form event and instead rely on H ...

How can you incorporate a module for typings without including it in the final webpack bundle?

As I venture into the realm of Webpack, I am faced with the challenge of transitioning from TypeScript 1.x to TypeScript 2. In my previous projects, I typically worked with TypeScript in one module using separate files, TSD for typings, and compiling throu ...

What causes the Angular child component (navbar) to no longer refresh the view after a route change?

Hello everyone, I'm excited to ask my first question here. Currently, I am working on developing a social network using the MEAN stack and socket.io. One of the challenges I am facing is displaying the number of unread notifications and messages next ...

Utilizing Angular 2's ngModel feature for dynamic objects and properties

Within my TypeScript file, I am dynamically generating properties on the object named selectedValsObj in the following manner: private selectValsObj: any = {}; setSelectedValsObj(sectionsArr) { sectionsArr.forEach(section => { section.questions. ...

Tips for effortlessly incorporating a new chip while maintaining a neat arrangement and ensuring button alignment

I am looking to enhance my website by adding chips with new tags in a neatly organized manner. Specifically, I want each new chip to be positioned next to the previous one and have the add-button shift to the right side, always staying in front of the last ...

Angular2 authguards encountering issues when trying to run asynchronous functions

I need a way to safeguard my routes by verifying if a user is logged in from the server, but I'm facing issues with asynchronous functions not executing properly. Below is the code snippet that's causing trouble: canActivate (route: ActivatedRo ...

Steps for updating the value of a button in Typescript and React

I currently have a button that manages my language switcher, configured to handle cookies, URL changes, and now I want it to update the translations on the page as well. The <img> tag is utilized for changing the country flag. < ...