I know that this question is asked many times and the answers helped me once.
I used to start as an experiment a Selenium Grid Hub on my local machine and an Node on an other machine. Both were started using parameters on the command line. I was able to start a test so the configuration worked.
Since I do not want to run the hub on my local machine I started is on the same machine as the node but now using JSON config files.
Now I get the WebDriverException: Error forwarding the new session cannot find ... giving the driver.version: unknown error.
I am sure that I pass the version so the error leaves me puzzled.
The node is according to the hub's out put correctly registered. The nodeconfig JSON is:
{
"capabilities":
[
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver",
"version": 93,
"platform": "WIN10"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://localhost:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
The console output in Eclipse shows this error description:
Caused by: org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --window-size=1920,955, --ignore-certificate-errors, --disable-gpu], extensions: []}, platform: WIN10, version: 93}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'XXXXXXXXXX', ip: 'ipx.xxx.xxx.xxx', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_302'
Driver info: driver.version: unknown
The hub show following:
ipy.yyy.yyy.yyy INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --window-size=1920,955, --ignore-certificate-errors, --disable-gpu], extensions: []}, platform: WIN10, version: 93}
ipy.yyy.yyy.yyy INFO [RequestHandler.process] - Error forwarding the new session cannot find : Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --window-size=1920,955, --ignore-certificate-errors, --disable-gpu], extensions: []}, platform: WIN10, version: 93}
org.openqa.grid.common.exception.CapabilityNotPresentOnTheGridException: cannot find : Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless, --window-size=1920,955, --ignore-certificate-errors, --disable-gpu], extensions: []}, platform: WIN10, version: 93}
The Chrome version on the node is 93.0.4577.82. Do I need to spell this out?
Can anyone give me a clue how to solve this?
All examples on the net are showing version numbers like 93.0 or 93 .
So yes, I had to spell it out like 93.0.4577.82
Related
I'm using the docker image selenium/standalone-chrome:4.0.0 to run selenium, and yesterday just started to throw errors.
This is are my chrome web driver options:
val chromeOptions = ChromeOptions()
chromeOptions.setHeadless(isHeadless)
chromeOptions.addArguments(
"--whitelisted-ips",
"--no-sandbox",
"--disable-extensions",
"start-maximized",
"enable-automation",
"--disable-infobars",
"--disable-dev-shm-usage",
"--disable-browser-side-navigation",
"--disable-gpu", "window-size=1980,960"
)
The errors I'm getting are:
session deleted because of page crash from tab crashed (Session info: headless chrome=81.0.4044.92) Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'ip-10-0-3-6.eu-west-1.compute.internal', ip: '10.0.3.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.152-127.182.amzn2.x86_64', java.version: '1.8.0_242' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.92, chrome: {chromedriverVersion: 81.0.4044.69 (6813546031a4b..., userDataDir: /tmp/.com.google.Chrome.LfBvAx}, goog:chromeOptions: {debuggerAddress: localhost:40023}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: none, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} Session ID: bfce4fb924589b8929dc0351195352e1 *** Element info: {Using=id, value=XXXXX`
invalid session id Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'ip-10-0-3-6.eu-west-1.compute.internal', ip: '10.0.3.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.152-127.182.amzn2.x86_64', java.version: '1.8.0_242' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.92, chrome: {chromedriverVersion: 81.0.4044.69 (6813546031a4b..., userDataDir: /tmp/.com.google.Chrome.LfBvAx}, goog:chromeOptions: {debuggerAddress: localhost:40023}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: none, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} Session ID: bfce4fb924589b8929dc0351195352e1
If I need to add more code please let me know.
Thanks in advance!
It seems like some version(s) of Chrome seem to crash in Docker containers, on certain pages, due to too small /dev/shm.
To solve it, simply mount -v /dev/shm:/dev/shm
Or, longer, create a big shm
Started in privileged mode: docker run --privileged
Fix small /dev/shm size
docker exec $id sudo umount /dev/shm
docker exec $id sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
Above is taken from here and credit goes to the respective owner.
You can also use Firefox and this should work without any problem.
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-37JVVAA', ip: '199.254.9.005', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: Driver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
at automationFramework.Driver.startWebDriver(Driver.java:80)
Caused by: java.io.IOException: unexpected end of stream on Connection{grid-selenium-hub.es-selenium-use.us-east-1.acceptance.com:4444, proxy=DIRECT hostAddress=grid-selenium-hub.es-selenium-use.us-east-1.acceptance.com/12.55.42.001:4444 cipherSuite=none protocol=http/1.1}
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:208)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
{
"browserTimeout": 0,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"cleanUpCycle": 5000,
"custom": {
},
"debug": false,
"host": "90.395.99.144",
"jettyMaxThreads": -1,
"newSessionRequestCount": 0,
"newSessionWaitTimeout": -1,
"port": 4444,
"registry": "org.openqa.grid.internal.DefaultGridRegistry",
"role": "hub",
"servlets": [
],
"slotCounts": {
"free": 10,
"total": 10
},
"success": true,
"throwOnCapabilityNotPresent": true,
"timeout": 1800,
"withoutServlets": [
]
}
Node has following:
browserTimeout: 0
debug: false
jettyMaxThreads: -1
host: 90.115.91.25:5555
port: 5555
role: node
timeout: 1800
cleanUpCycle: 5000
maxSession: 1
capabilities: Capabilities {applicationName: , browserName: chrome, maxInstances: 1, platform: LINUX, platformName: LINUX, seleniumProtocol: WebDriver, server:CONFIG_UUID: 277ded26-3931-42ec-b9e6-a6b..., version: 79.0.3945.117}
downPollingLimit: 2
hub: http://selenium-grid-selenium-hub:4444/grid/register
id: http://90.115.91.25:5555
nodePolling: 5000
nodeStatusCheckTimeout: 5000
proxy: org.openqa.grid.selenium.proxy.DefaultRemoteProxy
register: true
registerCycle: 5000
remoteHost: http://90.115.91.25:5555
unregisterIfStillDownAfter: 60000
Driver has following code
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("--disable-infobars");
options.addArguments("--disable-extensions");
options.addArguments("chrome.switches", "--disable-extensions");
options.addArguments("--disable-gpu");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--no-sandbox");
options.addArguments("--disable-notifications");
options.addArguments("--disable-popup-blocking");
options.addArguments("enable-automation");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--disable-browser-side-navigation");
options.addArguments("--dns-prefetch-disable");
options.setExperimentalOption("useAutomationExtension", false);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
world.driver = new RemoteWebDriver(new URL(AWS_URL), options);
world.driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
We recently created grid on aws and see this issue for some of the pods(which is working fine earlier), though its same hub URL for all
I am trying to use Browsermob proxy for achieving the basic http authentication across different browsers. But facing issues, tried to search for a solution on Browsermob's GITHUB page but didn't find much help there.
Here is my code for the achieving the auth:
// start the proxy
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start();
proxy.autoAuthorization("", "username", "password", AuthType.BASIC);
// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
If I run above code on chrome then it still asks for auth. And nothing appears in the error console.
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + config.getChromeDriverPath());
WebDriver driver = new ChromeDriver(capabilities);
If I run above code on firefox then it gives error
Your connection is not secure.
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + config.getChromeDriverPath());
WebDriver driver = new ChromeDriver(capabilities);
And in the console following error appears:
FAILED CONFIGURATION: #BeforeClass launchBrowser
org.openqa.selenium.WebDriverException:
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'USER', ip: '192.168.43.57', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_161'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 60.0.2, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 8180, moz:profile: C:\Users\USER\AppDat..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 6.3, proxy: Proxy(manual, http=tarun:49..., rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: 6b53fdb7-78fe-44cb-a3b9-2592494ae7a5
What is not correct?
proxy.autoAuthorization("", "guest", "guest", AuthType.BASIC);
this feature does not work.
Use this instead:
String encodedCreadentials = "Basic " + (Base64.getEncoder().encodeToString("login:password".getBytes()));
proxy.addHeader("Authorization", encodedCreadentials);
I am trying to run a test using the selenium server which will enable cross browser testing, but I'm getting this error
I have downloaded the standalone server and ran it through comand prompt and got a grid console such as the image file attached and my guess is only webdriver part is enabled and remote control part is not if so PLease guid me on how to solve this [Grid console][1]
this is the error
FAILED: test
org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
Command duration or timeout: 256 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'AKHIL-PC', ip: '192.158.0.29', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
The error suggests that you are missing chrome driver. did you download the chrome driver form here?
Did you add the chrome driver to your path variable
In Windows, goto System -> Advanced System Settings -> Advanced (Tab) -> Environment Variables
Under System variables, scroll to the Variable named Path -> Edit… (button) -> Variable value ->
Scroll to the end of the field, add a semicolon and append the local path of chromedriver.exe to the
end of the value field. Click OK:
To verify, open the Command Line (Run cmd.exe) -> Type chromedriver ->Hit Enter -> ChromeDriver
Also, restart the selenium standalone hubs and nodes
Let me know if it works
EDIT:
And if you configure your node via a xml file like:
{
"capabilities":
[
{
"browserName": "chrome",
"platform": "WINDOWS",
"maxInstances": 5,
"seleniumProtocol": "WebDriver",
"webdriver.chrome.driver": "C:/Selenium/drivers/chromedriver.exe",
"binary":"C:/Program Files/Google/Chrome/Application/chrome.exe"
}
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "<address to hub>",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
Change the webdriver.chrome.driver and binary to your own path.
and the to your hub url
And start your node via:
java -jar selenium-server-standalone-<version>.jar -role node -nodeConfig nodeConfig.json
I have a set of parallel tests which never have this problem when I run them locally. This only occurs on my piddly little two node grid. My tests are pretty consistently crapping out when I am trying to invoke WebDriver.getCurrentUrl(). The error message is this:
org.openqa.selenium.WebDriverException: Session [035e8f79-fdd7-4492-a565-f803df792d3c] was terminated due to TIMEOUT
Command duration or timeout: 90 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'bos-mpky6', ip: '172.30.31.59', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=46.0.1, platform=LINUX, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=035e8f79-fdd7-4492-a565-f803df792d3c, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 035e8f79-fdd7-4492-a565-f803df792d3c
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
at org.openqa.selenium.remote.RemoteWebDriver.getCurrentUrl(RemoteWebDriver.java:326)
At first, I thought this was a configuration problem, but I have configured my setup to have a a timeout much longer than a few milliseconds. Here is the configuration I use for the hub:
{
"host": null,
"port": 4444,
"newSessionWaitTimeout": -1,
"servlets" : [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 300000,
"browserTimeout": 0,
"jettyMaxThreads":-1
}
Here is the configuration I am using for both my nodes:
{
"capabilities":
[
{
"browserName": "firefox",
"version": "46.0.1",
"platform": "LINUX",
"maxInstances": 5
}
],
"configuration":
{
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"nodeTimeout":500000,
"port":5555,
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":500000
}
}
I am not using Docker or anything like that. I have tried versions 2.53.1, 2.53.0, 2.52.0 and 2.51.0 of the grid server and the problem continues to plague my tests. Is there something I can do to get rid of this problem? I can't find a configuration setting related to timeouts that seems to get rid of this.
I had the same error, when I adjusted the timeout and browserTimeout properties. My solution was to set the hub configuration back to default. But you already have the same like I do now.
BUT I've seen a slight difference in your node configuration.
I'm using Windows 7 as node and this is my config:
{
"capabilities": [
{
"browserName": "firefox",
"maxInstances": 2,
"takesScreenshot": true,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"version": "11",
"webdriver.ie.driver": "<MOUNT>\Selenium\IEDriverServer_2.53.1_32bit",
"takesScreenshot": true,
"platform": "WINDOWS",
"seleniumProtocol": "WebDriver"
}
],
"configuration": {
"_comment" : "Configuration for Node",
"cleanUpCycle":5000,
"timeout": 500,
"port": 8088,
"hubHost": V0001172,
"register": true,
"hubPort": 8089,
"maxSession": 1
}
}
I added the seleniumProtocol to my node configuration. I can't remember where I found this, but in my setup it works.