WebDriverError: No active session with ID - javascript

My tests fail when am running them on TFS with the below error
WebDriverError: No active session with ID
Failed: No active session with ID
The same tests pass locally - it was working fine until couple days back, but seeing this issue now
using
protractor version - 5.4.2
Chrome driver - 2.42.exe

The problem is due to the version mismatch between the driver and browser version.
use the below version of chrome driver and corresponding browser version in you remote machine where your tests are executed
If you are using Chrome version 74, please download ChromeDriver 74.0.3729.6
If you are using Chrome version 73, please download ChromeDriver 73.0.3683.68
If you are using Chrome version 72, please download ChromeDriver 2.46
Refer here for more info http://chromedriver.chromium.org/downloads/version-selection
Hope it helps you

Related

I have some problem with upgrading my chrome driver

I have console error after starting js selenium test:
DevTools listening on ws://127.0.0.1:51114/devtools/browser/ca96d3a3-e745-460c-9029-6102f08b81d9
(node:2632) UnhandledPromiseRejectionWarning: SessionNotCreatedError: session not created: This
version of ChromeDriver only supports Chrome version 80
There is error of incorrect selenium version and chrome driver. I have Chrome 83 version and I want to update chrome driver.
I input 'npm update', 'npm install', but error is present. The chrome driver isn't upgraded using this way. All links from browser search link me to the
https://sites.google.com/a/chromium.org/chromedriver/downloads
I downloaded this archive for windows 10, but it is console launcher to use chrome driver separate. It isn't update chrome driver in the node modules.
How can I upgrade my chrome driver?
https://chromedriver.chromium.org/downloads
Use latest chrome driver version and set path correctly

Error shows when I have the correct set up. "SessionNotCreatedError: session not created: Chrome version must be between 70 and 73"

I was doing an automate testing with selenium-webdriver. I am building a driver using chromedriver. It was working good but one day I run a test and this following error message shows up
SessionNotCreatedError: session not created: Chrome version must be between 70 and 73
(Driver info: chromedriver=73.0.3683.20 (8e2b610813e167eee3619ac4ce6e42e3ec622017),platform=Mac OS X 10.14.3 x86_64)
but I have no idea what is going on that my package.json shows me it is chromedriver^73.0.0.0. An I have try to uninstall the previous version v2.45, and this similar message shows up.
I have tried so many times for doing npm uninstall and install, also try to install locally but does not help. I know update to v74 works, but some for some reason, i need to stay with the version v73.
Does anyone how to solve this?
I think there is an mismatch between your chrome browser and driver. Downgrade your chrome browser, please.

TypeError: 'NoneType' object is not subscriptable while invoking execute_script() for Chrome Download Manager through Selenium

I have been using this function https://stackoverflow.com/a/48267887/11220889 for waiting for downloads to finish and returning the file path once finished. And it has been working great until now.
The Function
def every_downloads_chrome(driver):
if not driver.current_url.startswith("chrome://downloads"):
driver.get("chrome://downloads/")
return driver.execute_script('''
var items = downloads.Manager.get().items_;
if (items.every(e => e.state === "COMPLETE"))
return items.map(e => e.file_url);
''')
How its called
paths = WebDriverWait(driver, 120, 1).until(every_downloads_chrome)
Error I'm receiving
TypeError: 'NoneType' object is not subscriptable
So from what I can gather something has changed that has started causing the function to not return a path. I believe this is due to a change within chrome or even more specifically the chrome driver. My two reasons for this assumption is:
1) I had this function in another code that my colleague was using and she called me saying it was producing this error yesterday.
2)Neither code has changed so the change must be in chrome
I would like to keep using this script but if not possible have another function that waits for the downloads to finish and returns the paths and ideally does it all through the driver not through file path since multiple users use my codes on multiple machines.
EDIT: Versions-
Name: selenium
Version: 3.141.0
Name: Chrome Browser
Version: 73.0.3683.86
Name: Chrome Driver
Version: 2.43.600210
Name: System
Version: Windows 10 Pro x64
As per the error message:
TypeError: 'NoneType' object is not subscriptable
Your main issue seems to be incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.43
Release Notes of chromedriver=2.43 clearly mentions the following :
Supports Chrome v69-71
You are using chrome=73.0
Release Notes of ChromeDriver v2.46 clearly mentions the following :
Supports Chrome v71-73
So there is a clear mismatch between ChromeDriver v2.43 and the Chrome Browser v73.0
Solution
Upgrade ChromeDriver to current ChromeDriver v2.46 level.
Keep Chrome version at Chrome v73 level. (as per ChromeDriver v2.46 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
Update
Currently GAed Chrome v73 have some issues and you may like to downgrade to Chrome v72. You can find a couple of relevant discussions in:
Getting Timed out receiving message from renderer: 600.000 When we execute selenium scripts using Jenkins windows service mode
Timed out receiving message from renderer: 10.000 while capturing screenshot using chromedriver and chrome through Jenkins on Windows

Jenkins + Selenium random unknown server-side error during Karma+Mocha tests

I have CI system. It consists of
Jenkins Master server (version 2.60.2) running on Ubuntu 16.04
Jenkins slaves Swarm Slave (version 3.4.1) running on Ubuntu 16.04
Selenium hub (version 3.4.0) running on Ubuntu 16.04
4 Selenium nodes for Safari Browser (version 3.4.0) Running on Mac OS Siera 10.12.5 .
With Safari 10.
Im testing Java Script project that uses Mocha+Karma to run tests.
Most of the time everything is working as it should.
But sometimes i have error like this one.
{"message":"[get(\"http://my-jenkins-slave-hostname:9876/?id=39481\")] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $","status":13,"cause":{"value":{"stacktrace":"com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient...
It looks like some nodes of selenium sometimes fail randomly.
All nodes are exact replicas of same image (Im using Mac Stadium to manage Mac OS nodes)
Ive tried to configure Karma to give more details in logs, ive tried to increase timeouts, but no luck. Error message stays the same.
How can i troubleshoot such problem?
Any ideas?

How to debug remote v8-based application using Chrome Dev Tools

v8 has its own JSON based remote-debugging protocol and two UI debuggers:console application D8 and a eclipse plugin(hosted at http://code.google.com/p/chromedevtools)
Chrome use WebKit Remote Debugging Protocol including Console, DOM Debugger, ..., Debugger
"WebKit Remote Debugging Protocol" is a Google Chrome/Chromium debug protocol. You will find its description at http://developers.google.com/chrome-developer-tools/docs/remote-debugging
So is it possible to use the Chrome Dev Tools ships with chrome to debug remote v8-based application?
Try Node Webkit Agent for NodeJS version >= 0.6
Node-inspector is for NodeJS version 0.4
The setup need to be set in your node server and access the URL provided by the library base on your node version. You cannot use Developer Tools in Chrome directly.
node-inspector is designed to do exactly what you ask.
It seems that it competes with Node Webkit Agent. I haven't tried webkit agent yet as it seems newer and it failed to install without some meddling. node-inspector worked for me, and fairly well, although there is a bit of latency from running a statement to getting the output marshaled into Chrome's debugger. Overall, it's an extremely useful tool.

Categories