my machine is windows 7, chrome is latest with 32 bit, below is conf.js
exports.config = {
// directConnect:true,
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js'],
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'binary': 'D:/chromedriver.exe',
} },
};
when i run above conf.js below error comes
[21:37:58] I/launcher - Running 1 instances of WebDriver
[21:37:58] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[21:39:02] E/launcher - chrome not reachable
[21:39:02] E/launcher - WebDriverError: chrome not reachable
(Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c581090
6a),platform=Windows NT 6.1.7601 SP1 x86) (WARNING: The server did not provide a
ny stacktrace information)
[21:39:02] E/launcher - Process exited with error code 199
below is selenium server starting log,its 32 bit machine with basic code for protractor
webdriver-manager: using global installed version 12.0.6
[22:39:26] I/start - java -Dwebdriver.chrome.driver=C:\Users\Yogi\AppData\Roamin
g\npm\node_modules\webdriver-manager\selenium\chromedriver_2.32.exe -Dwebdriver.
gecko.driver=C:\Users\Yogi\AppData\Roaming\npm\node_modules\webdriver-manager\se
lenium\geckodriver-v0.18.0.exe -jar C:\Users\Yogi\AppData\Roaming\npm\node_modul
es\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar -port 4444
[22:39:26] I/start - seleniumProcess.pid: 6016
22:39:38.385 INFO - Selenium build info: version: '3.5.3', revision: 'a88d25fe6b
'
22:39:38.401 INFO - Launching a standalone Selenium Server
2017-09-14 22:39:39.174:INFO::main: Logging initialized #11199ms to org.selenium
hq.jetty9.util.log.StdErrLog
22:39:40.463 INFO - Driver class not found: com.opera.core.systems.OperaDriver
22:39:41.354 INFO - Driver provider class org.openqa.selenium.safari.SafariDrive
r registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform
=MAC}] does not match the current platform VISTA
22:39:42.073 INFO - Using the passthrough mode handler
2017-09-14 22:39:42.862:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-09-14 22:39:43.354:WARN:osjs.SecurityHandler:main: ServletContext#o.s.j.s.S
ervletContextHandler#1784306{/,null,STARTING} has uncovered http methods for pat
h: /
2017-09-14 22:39:43.448:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletC
ontextHandler#1784306{/,null,AVAILABLE}
2017-09-14 22:39:49.823:INFO:osjs.AbstractConnector:main: Started ServerConnecto
r#95a785{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-09-14 22:39:49.823:INFO:osjs.Server:main: Started #21844ms
22:39:49.823 INFO - Selenium Server is up and running
'chromeOptions': {
'binary': 'D:/chromedriver.exe',
}
The binary should be specify chrome.exe location not webdriver of chrome. please remove the chromeOptions if your chrome browser install in defaul location, otherwise specify the correct path at here.
Related
i installed selenium-server-standalone-3.4.0.jar and run following command(as hube) on my machine A:
java -jar selenium-server-standalone-3.4.0.jar -role hub
it runs successfuly.
then, on my machine B(as node) run following command:
java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://192.168.1.27:4444/grid/register
following logs produced. As you can see see, first it registered then it indicates it is not registered. How could be possible?
> 11:35:29.561 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
> 11:35:29.562 INFO - Launching a Selenium Grid node
> 11:35:30.353 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 2017-07-23 11:35:30.417:INFO::main: Logging initialized #1343ms to org.seleniumhq.jetty9.util.log.StdErrLog
> 11:35:30.568 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
> 11:35:30.568 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
> 11:35:30.572 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 11:35:30.572 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
> 11:35:30.573 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 11:35:30.575 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
> 11:35:30.585 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
> 2017-07-23 11:35:30.729:INFO:osjs.Server:main: jetty-9.4.3.v20170317
> 2017-07-23 11:35:30.828:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#70be0a2b{/,null,AVAILABLE}
> 2017-07-23 11:35:30.899:INFO:osjs.AbstractConnector:main: Started ServerConnector#29176cc1{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
> 2017-07-23 11:35:30.900:INFO:osjs.Server:main: Started #1827ms
> 11:35:30.900 INFO - Selenium Grid node is up and ready to register to the hub
> 11:35:31.017 INFO - Starting auto registration thread. Will try to register every 5000 ms.
> 11:35:31.017 INFO - Registering the node to the hub: http://192.168.1.27:4444/grid/register
> 11:35:31.062 INFO - The node is registered to the hub and ready to use
> 11:35:36.095 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 11:35:41.123 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 11:35:46.135 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
Here is the Answer to your Question:
Assuming that your requirement is to run the Selenium Grid Hub on default port 4444 and Selenium Grid Node on default port 5555 we need to configure and start them as follows:
Start the Selenium Grid Hub:
java -jar selenium-server-standalone-3.4.0.jar -role hub
The following logs confirms your Selenium Grid Hub is running properly:
2017-07-24 15:31:46.139:INFO:osjs.Server:main: Started #2757ms
15:31:46.140 INFO - Nodes should register to http://192.168.0.107:4444/grid/register/
15:31:46.140 INFO - Selenium Grid hub is up and running
Access the Selenium Grid Console through the URL:
http://localhost:4444/grid/console
Start the Selenium Grid Node:
java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<IP_GRID_HUB>:4444/grid/register
I have used localhost so I used:
java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register
The following logs confirms your Selenium Grid Node is running properly:
15:35:44.939 INFO - Selenium Grid node is up and ready to register to the hub
15:35:44.958 INFO - Starting auto registration thread. Will try to register every 5000 ms.
15:35:44.958 INFO - Registering the node to the hub: http://localhost:4444/grid/register
15:35:45.231 INFO - The node is registered to the hub and ready to use
Access the Selenium Grid Console through the console URL to see the registered Node:
http://localhost:4444/grid/console
Let me know if this Answers your Question.
I was able to solve this by updating the version of chrome to latest (60) and the version of the chromedriver to latest.
It finally started working when I updated the version of the chromedriver on the hub side as well.
When I have some time I will be switching to seleniumGridExtra which is supposed to manage the versions automatically.
My work log:
8/3/2017, 10:11:03 AM
Still trying to get selenium running on the hub/node setup. It stopped 17 hours ago.
Updating all the files involved.
Latest chrome firefox and IE drivers.
Latest selenium version
Update chrome
rebooted machine
Updated chromeDriver on the hub..which seems silly.
Suddenly working fine.
Lessons learned:
Switch to selenium grid extras. They handle the version dependencies.
I am new to this but here what works for me. I run hub and node from same machine, I run hub and node from the window batch file. I run the hub first and make sure to leave the window opened then I run the grid. I didn't the connection issue since I started doing that
I am using nightwatch.js and selenium to test my application web, i tried a lot of solution in the net, but always the same errors :
D:\nightwatch\node_modules\nightwatch\lib>java -jar selenium-server-standalone-2
.53.0.jar
18:42:37.363 INFO - Launching a standalone Selenium Server
18:42:37.440 INFO - Java: Oracle Corporation 25.92-b14
18:42:37.441 INFO - OS: Windows 7 6.1 amd64
18:42:37.448 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b
18:42:37.492 INFO - Driver class not found: com.opera.core.systems.OperaDriver
18:42:37.493 INFO - Driver provider com.opera.core.systems.OperaDriver is not re gistered
18:42:37.499 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=,platform=MAC}] does not match the current platform VISTA
18:42:37.500 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
18:42:37.501 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
18:42:37.598 INFO - RemoteWebDriver instances should connect to:http://127.0.0.1:4444/wd/hub
18:42:37.599 INFO - Selenium Server is up and running
Is there any limitations to start Selenium Server on CentOS7? Followings are my environments. I was able to start it on CentOS6.5.
Worked
CentOS6.5
Kernel: 2.6.32-431.17.1.el6.x86_64
java: 1.8.0_65
Selenium Server: 2.47.1
# java -jar selenium-server-standalone-2.47.1.jar
14:44:39.511 INFO - Launching a standalone Selenium Server
14:44:39.580 INFO - Java: Oracle Corporation 25.65-b01
14:44:39.581 INFO - OS: Linux 2.6.32-431.17.1.el6.x86_64 amd64
14:44:39.612 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
14:44:39.769 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
14:44:39.771 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
14:44:39.771 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:44:39.771 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
14:44:39.935 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
14:44:39.935 INFO - Selenium Server is up and running
Didn't work
CentOS7
Kernel: 3.10.0-229.7.2.el7.x86_64
java: Same version
Selenium Server: Same version
# java -jar selenium-server-standalone-2.47.1.jar
05:47:08.911 INFO - Launching a standalone Selenium Server
05:47:08.988 INFO - Java: Oracle Corporation 25.65-b01
05:47:08.988 INFO - OS: Linux 3.10.0-229.7.2.el7.x86_64 amd64
05:47:09.015 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
05:47:09.145 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
05:47:09.146 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
05:47:09.146 INFO - Driver class not found: com.opera.core.systems.OperaDriver
05:47:09.146 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
Thank you.
I think this answer can help. Please see Selenium standalone server not starting.
In short: Just add the parameter when starting selenium: -Djava.security.egd=file:///dev/urandom switch and you're good to go
Just wanted to ask why Selenium RC is not able to work with recent Firefox versions?
Here is the code (groovy):
import org.openqa.selenium.server.*;
import com.thoughtworks.selenium.DefaultSelenium
import com.thoughtworks.selenium.Selenium
import com.thoughtworks.selenium.SeleniumException
import com.thoughtworks.selenium.Wait
import java.util.concurrent.TimeUnit
RemoteControlConfiguration rcc = new RemoteControlConfiguration()
System.out.println("Using firefox launcher")
File ffp = new File("C:\\Work\\ff_custom_profile")
rcc.setFirefoxProfileTemplate(ffp)
rcc.setPort(4444)
seleniumServer = new SeleniumServer(rcc)
seleniumServer.start()
System.out.println("Server started")
Selenium seleniumInstance = new DefaultSelenium("localhost", 4444, "firefox", "https://url/")
seleniumInstance.start()
System.out.println("Driver started");
When I run this code with Firefox 28 (Windows 7 x86), it works fine:
Using firefox launcher
20:46:35.692 INFO - Java: Sun Microsystems Inc. 20.14-b01
20:46:35.692 INFO - OS: Windows 7 6.1 x86
20:46:35.723 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
20:46:36.020 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:46:36.020 INFO - Version Jetty/5.1.x
20:46:36.020 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:46:36.035 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:46:36.035 INFO - Started HttpContext[/,/]
20:46:36.067 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1114460
20:46:36.067 INFO - Started HttpContext[/wd,/wd]
20:46:36.067 INFO - Started SocketListener on 0.0.0.0:4444
20:46:36.067 INFO - Started org.openqa.jetty.jetty.Server#15e0873
Server started
20:46:36.160 INFO - Checking Resource aliases
20:46:36.191 INFO - Command request: getNewBrowserSession[firefox, https://url/, ] on session null
20:46:36.207 INFO - creating new remote session
20:46:36.238 INFO - Allocated session 640d3bf362ab4840ad7c3f3ac2b5695d for https://url/, launching...
jar:file:/C:/Work/TMP/selenium-server-standalone-2.43.1.jar!/customProfileDirCUSTFFCHROME
20:46:36.925 INFO - Preparing Firefox profile...
20:46:38.127 INFO - Launching Firefox...
20:46:41.537 INFO - Got result: OK,640d3bf362ab4840ad7c3f3ac2b5695d on session 640d3bf362ab4840ad7c3f3ac2b5695d
Driver started
But when I run this code with Firefox 32 or 33 (Windows 7 x86), I gets the following:
Using firefox launcher
20:49:26.467 INFO - Java: Sun Microsystems Inc. 20.14-b01
20:49:26.467 INFO - OS: Windows 7 6.1 x86
20:49:26.467 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
20:49:26.576 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:49:26.576 INFO - Version Jetty/5.1.x
20:49:26.591 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:49:26.591 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:49:26.591 INFO - Started HttpContext[/,/]
20:49:26.607 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1114460
20:49:26.607 INFO - Started HttpContext[/wd,/wd]
20:49:26.623 INFO - Started SocketListener on 0.0.0.0:4444
20:49:26.623 INFO - Started org.openqa.jetty.jetty.Server#15e0873
Server started
20:49:26.669 INFO - Checking Resource aliases
20:49:26.669 INFO - Command request: getNewBrowserSession[firefox, https://url/, ] on session null
20:49:26.669 INFO - creating new remote session
20:49:26.685 INFO - Allocated session 740dfe19fd58418db02be166c420516d for https://url/, launching...
jar:file:/C:/Work/TMP/selenium-server-standalone-2.43.1.jar!/customProfileDirCUSTFFCHROME
20:49:27.247 INFO - Preparing Firefox profile...
20:49:28.386 INFO - Launching Firefox...
Please, note the difference in the output: with Firefox 28, Selenium client started successfully ...
20:46:41.537 INFO - Got result: OK,640d3bf362ab4840ad7c3f3ac2b5695d on session 640d3bf362ab4840ad7c3f3ac2b5695d
... while with Firefox 32 or 33 it failed.
I ran some experiments and found out that I can make it work in FF 32 or 33 by changing the following setting in Firefox profile (prefs.js):
user_pref("browser.startup.homepage_override.mstone", "33.1.1");
If I change it to the value that was in my FF 28 profile (16.0.2):
user_pref("browser.startup.homepage_override.mstone", "16.0.2");
then, it works fine. But I don't like this hack for two reasons:
When I open Firefox after this change with the script, it opens the Whatsnew page (https://www.mozilla.org/en-US/firefox/33.1.1/whatsnew/?oldversion=16.0.2) and it is very annoying for automation.
When I open Firefox after this change manually, this setting goes back to its previous value (33.1.1) and the story starts from the beginning.
I tried different Selenium RC version (2.41, 2.42, 2.43) with the same results.
With Firefox 32 & 33 and Selenium RC 2.44, I get the following error: Failed to start new browser session: java.lang.RuntimeException: java.lang.RuntimeException: Firefox could not be found in the path! Please add the directory containing ''firefox.exe'' to your PATH environment.
Well, I changed the code to...
Selenium seleniumInstance = new DefaultSelenium("localhost", 4444, "*firefox C:\Program Files\Mozilla Firefox\firefox.exe", "https://url/"
... and get the same failure as described above for Selenium 2.42 and 2.43.1.
So here is the question: why Firefox 32 or 33 doesn't work with Selenium RC, and how to make it work?
A note: I do realize it makes sense to migrate to Selenium 2 (WebDriver), but for some reasons, I need to support this legacy code at its current state.
Usually selenium will release a newer version of their client shortly after a browser update. Keep an eye on the downloads page.
$ java -jar selenium-server-standalone-2.0b3.jar
00:17:03.883 INFO - Java: Sun Microsystems Inc. 19.0-b09
00:17:03.885 INFO - OS: Linux 2.6.32-305-ec2 i386
00:17:03.889 INFO - v2.0 [b3], with Core v2.0 [b3]
00:17:04.501 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
00:17:04.530 INFO - Version Jetty/5.1.x
00:17:04.531 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
00:17:04.532 INFO - Started HttpContext[/selenium-server,/selenium-server]
00:17:04.532 INFO - Started HttpContext[/,/]
00:17:04.614 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#13c5982
00:17:04.614 INFO - Started HttpContext[/wd,/wd]
00:17:04.618 INFO - Started SocketListener on 0.0.0.0:4444
00:17:04.618 INFO - Started org.openqa.jetty.jetty.Server#1ffb8dc
When I run this script:
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Remote('http://localhost:4444/wd/hub', {'browser_name':'firefox','platform':'ANY', 'version':'','javascript_enabled':True})
browser.get("http://www.yahoo.com")
The Selenium server seems to work at first:
00:17:08.776 INFO - Executing: [new session: {platform=ANY, browser_name=firefox, javascript_enabled=true, version=}] at URL: /session)
But then I get a python error:
Traceback (most recent call last):
File "fb2.py", line 13, in <module>
browser = webdriver.Remote('http://localhost:4444/wd/hub', {'browser_name':'firefox','platform':'ANY', 'version':'','javascript_enabled':True})
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 60, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 96, in start_session
'desiredCapabilities': desired_capabilities,
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 142, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 100, in check_response
raise exception_class(message)
selenium.common.exceptions.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
Looks like you're using Selenium Grid. The grid consists of a hub and nodes which connect to it. When you run a test you send a request to the server which dispatches it accordingly to a host with the appropriate configuration according to what you defined in desired_capabilities. In this case you don't seem to have started a node anywhere.
You have failed to start a node it seems. Also I believe to use a WebDriver requires Grid 2.0. As I understand it, the build you are using only has Grid support for RC API. You can use the following guide if you download and compile the current trunk:
http://code.google.com/p/selenium/wiki/Grid2