groupon / Selenium-Grid-Extras

Simplify the management of the Selenium Grid Nodes and stabilize said nodes by cleaning up the test environment after the build has been completed
BSD 3-Clause "New" or "Revised" License
536 stars 210 forks source link

Need sample testcase #260

Open viveksoundarrajan opened 7 years ago

viveksoundarrajan commented 7 years ago

Hi Guys, I am new to selenium-grid-extra, I would like to work with this please give me some example testcases. I can't start new browser session using

driver = new RemoteWebDriver(new URL("http://172.0.1.1:3000/wd/hub"), capablities);

smccarthy commented 7 years ago

Hi, you wouldn't use port 3000. Use your hub port (defaults to 4444).

Port 3000 is for the grid extras endpoint. Go to http://ip:3000/api to see all the options or just http://ip:3000 to see a general overview. Please respond back if you need more help

viveksoundarrajan commented 7 years ago

No, when I try to create a new session, It's not opening the browser. and It gives me an error like this

"Error Message - Start: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure."

and I used to create a new webdriver session by using this following code.

driver = new RemoteWebDriver(new URL("http://192.168.225.180:4444/wd/hub"), capablities);

but, my hub is not launched yet. when I used to see the url on browser It showed me like The Webpage is not available. And I have an another problem, Once I started the hub in my machine I can't start a node in same machine. help me.

smccarthy commented 7 years ago

@viveksoundarrajan Did you start the selenium grid extras ? Selenium Grid Extras will start the hub and the node. Choose option 3 during the First Time Run Config, which will set your machine up to be a hub + node. If you did choose option 3 during the Selenium Grid Extras setup, did you get any error in the logs (log/grid_extras.2016-10-13.log, log/hub_4444.log, or log/node_5555.log) ?

Also, can you post your config files ?: selenium_grid_extras_config.json hub_4444.json node_5555.json

Thank you.

viveksoundarrajan commented 7 years ago

@smccarthy Here I posted my config files. selenium_grid_extras_config.json

{ "theConfigMap": { "auto_start_hub": "1", "default_role": "hub", "auto_update_browser_versions": "0", "video_recording_options": { "videos_to_keep": "40" }, "node_config_files": [ "node_5555.json" ], "hub_config": {}, "hub_config_files": [ "hub_4444.json" ], "iedriver": {}, "auto_start_node": "1", "geckodriver": { "version": "0.11.1" }, "auto_update_drivers": "0", "chromedriver": { "bit": "32", "version": "2.24" }, "webdriver": { "version": "2.53.1" }, "log_maximum_age_ms": 864000000 } }

hub_4444.json

{ "port": 4444, "newSessionWaitTimeout": 25000, "servlets": [ "com.groupon.seleniumgridextras.grid.servlets.ProxyStatusJsonServlet" ], "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "nodePolling": 5000, "cleanUpCycle": 5000, "browserTimeout": 120000, "timeout": 120000, "maxSession": 5 }

node_5555.json

{ "capabilities": [ { "platform": "LINUX", "seleniumProtocol": "WebDriver", "browserName": "firefox", "maxInstances": 3, "version": "40.0.3" }, { "platform": "LINUX", "seleniumProtocol": "WebDriver", "browserName": "chrome", "maxInstances": 3, "version": "44.0" }, { "platform": "LINUX", "seleniumProtocol": "WebDriver", "browserName": "phantomjs", "maxInstances": 3, "version": "1.9.8" } ], "configuration": { "proxy": "com.groupon.seleniumgridextras.grid.proxies.SetupTeardownProxy", "maxSession": 3, "port": 5555, "register": true, "unregisterIfStillDownAfter": 10000, "hubPort": 4444, "hubHost": "192.168.225.180", "registerCycle": 5000, "nodeStatusCheckTimeout": 10000, "downPollingLimit": 0 } }

And here my selenium grid extras snapshot image 1 image 2

viveksoundarrajan commented 7 years ago

@smccarthy I face Error: Could not find or load main class org.openqa.grid.selenium.GridLauncher this type of error in log/grid_extras.2016-10-14.log file. and here I didn't find any log/hub_4444.log, or log/node_5555.log files. Here I give the Error I find in grid_extras.2016-10.14.log

14 Oct 2016 12:08:14 [main] INFO seleniumgridextras.SeleniumGridExtras - {"exit_code":0,"out":[],"error":[]} 14 Oct 2016 12:08:14 [main] INFO seleniumgridextras.SeleniumGridExtras - Selenium Grid Extras has been started! Navigate to http://127.0.1.1:3000 for more details 14 Oct 2016 12:08:14 [main] INFO shutdownhooks.VideoShutdownHook - Creating instance of the video shutdown hook 14 Oct 2016 12:08:14 [main] INFO shutdownhooks.VideoShutdownHook - Video Render Shut Down Hook Attached. 14 Oct 2016 12:08:14 [main] INFO shutdownhooks.CleanTempShutdownHook - Creating instance of the clean temp shutdown hook 14 Oct 2016 12:08:14 [pool-1-thread-1] INFO threads.ExecuteOsTaskCallable - Command finished. command: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -cp /home/local/vivek/seleniumExtras/SeleniumGridExtras-1.12.4-SNAPSHOT-jar-with-dependencies.jar:/tmp/webdriver/2.53.1.jar org.openqa.grid.selenium.GridLauncher -role hub -log log/hub_4444.log -hubConfig hub_4444.json exit code: 1 standard error: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 Error: Could not find or load main class org.openqa.grid.selenium.GridLauncher

14 Oct 2016 12:08:14 [pool-1-thread-2] INFO threads.ExecuteOsTaskCallable - Command finished. command: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Dwebdriver.chrome.driver=/tmp/webdriver/chromedriver/chromedriver_2.24_32bit -Dwebdriver.gecko.driver=/tmp/webdriver/geckodriver/geckodriver -cp /home/local/vivek/seleniumExtras/SeleniumGridExtras-1.12.4-SNAPSHOT-jar-with-dependencies.jar:/tmp/webdriver/2.53.1.jar org.openqa.grid.selenium.GridLauncher -role wd -friendlyHostName vivek -nodeConfig node_5555.json -log log/node_5555.log exit code: 1 standard error: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 Error: Could not find or load main class org.openqa.grid.selenium.GridLauncher

shankarkc commented 7 years ago

I think you are not running command from the directory where grid extra jar/json files present. In past i stumbled on this issue. CD to that directory fixed it. Let me know.

smccarthy commented 7 years ago

@viveksoundarrajan I am unsure. The class org.openqa.grid.selenium.GridLauncher is correct for 2.53.1 (which you are using). For 3.0 the class changed to org.openqa.grid.selenium.GridLauncherV3

I am releasing Selenium Grid Extras 1.12.5 in a day or two with some more fixes, so maybe that would help (I can't be sure tho)

smccarthy commented 7 years ago

@viveksoundarrajan Can you check if https://github.com/groupon/Selenium-Grid-Extras/issues/260#issuecomment-255402412 fixes your issue? Thank you.

shankarkc commented 7 years ago

One more thing that you can can check is webdriver jar file. It will be /tmp/webdriver/2.53.1.jar Open that in java decompiler ui and see if its fine. If its corrupt delete it. Grid extra will download it for you (if you have specified right proxy assuming that you are behind firewall)