I've Installed Docker o my Computer and ran the following command
root@DESKTOP-51NFMIM:~# docker run -d -p 4446:4444 --name selenium-hub selenium/hub
&
docker run -d -P -e no_proxy=localhost -e HUB_ENV_no_proxy=localhost --link selenium-hub:hub selenium/node-firefox-debug
Then I view Logs on Hub
10:08:05.520 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
10:08:05.521 INFO - Launching Selenium Grid hub
2018-01-02 10:08:06.102:INFO::main: Logging initialized @833ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:08:06.115 INFO - Will listen on 4444
2018-01-02 10:08:06.157:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-01-02 10:08:06.187:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2018-01-02 10:08:06.187:INFO:osjs.session:main: No SessionScavenger set, using defaults
2018-01-02 10:08:06.189:INFO:osjs.session:main: Scavenging every 660000ms
2018-01-02 10:08:06.202:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@23f7d05d{/,null,AVAILABLE}
2018-01-02 10:08:06.213:INFO:osjs.AbstractConnector:main: Started ServerConnector@2e457a5e{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-01-02 10:08:06.213:INFO:osjs.Server:main: Started @944ms
10:08:06.213 INFO - Nodes should register to http://172.17.0.2:4444/grid/register/
10:08:06.214 INFO - Selenium Grid hub is up and running
10:10:04.000 INFO - Registered a node http://172.17.0.3:5555
10:10:04.000 INFO - Registered a node http://172.17.0.4:5555
I expose port 4446 on localhost Here I create Hub and 2 chrome node in the different container.So here I want to run my code on this 2 node.
In real PC I run it from Hub and my java code was
if (browser.equalsIgnoreCase("firefox")) {
System.out.println(" Executing on FireFox");
String Node = "http://172.17.0.3:5555/wd/hub";
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
driver = new RemoteWebDriver(new URL(Node), cap);
// Puts an Implicit wait, Will wait for 10 seconds before throwing
// exception
wd.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Launch website
wd.manage().window().maximize();
}
But here in my docker, I want to run code on docker how can I do this. I do not understand because in real pc I run code from my hub pc to another node pc.
Any suggestion for this how can I run code my pc to the different container?