Selenium remotewebdriver stuck before launching browser - selenium

I'm trying to launch Firefox remotely on a windows machine from UNIX box using remotewebdriver I am also starting the selenium node remotely using ssh(It starts fine) using Cygwin and OpenSSH.
(I've installed firefox in the path c:\cygwin64\home\Administrator\firefox)
I am launching the grid node using:
java -jar selenium-server-standalone-2.53.0.jar -role node -hub http://HUB_IP:4444/grid/register -port 5566 -Dwebdriver.gecko.driver=geckodriver.exe -Dwebdriver.firefox.bin="firefox/firefox.exe"
However, the execution gets stcuk at:
1486534648695 mozprofile::profile INFO Using profile path C:\cygwin64\tmp\rust_mozprofile.lpsQghom5pxe
1486534648699 geckodriver::marionette INFO Starting browser C:\cygwin64\home\Administrator\firefox\firefox.exe
1486534648719 geckodriver::marionette INFO Connecting to Marionette on localhost:57059
1486534650177 Marionette INFO Listening on port 57059
I can see the firefox process starts but browser does not launch and gets stuck.(Tried the same for chrome, getting the same issue)
After waiting for a long time, node throws exception:,
A coding exception was thrown and uncaught in a Task.
Full message: TypeError: NetworkError when attempting to fetch resource.
Full stack:
EDIT:
I cannot launch Firefox/Chrome from Cygwin when I manually go to the installation path and give the command firefox.exe. This gets stuck as well but a process is started. This occurs only when I use a remote connection. Though, using Cygwin locally launches the browsers.
Is there a way to enable this?

Related

Selenium exited before it could start error while running WCT in Jenkins Pipeline

I get errors while running WCT in the Jenkins pipeline. I share that errors detail on the bottom. These errors may be related to Openshift. Maybe you can share your opinion.
Note: My tests are running at Openshift.
First case:
-> I running with a chrome configuration. In this case, I get the following error. This error message is clear. We must install chrome. But I don't know how to do it.
Error:
The following browsers were not found: chrome. (All installed browsers found: firefox)
Error image:
Second case:
-> Because of the above error I changed browser configuration to firefox. But I take a different error this time. This error is complicated for me. I need more detail about this error. According to my research, there may be many reasons for this. Maybe we should add/change some options on Openshift.
Note:
Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true 10:12:47.767 INFO [GridLauncherV3.parse] - Selenium server version:
3.141.59, revision: e82be7d358 10:12:47.857 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone
Selenium Server on port 33226 2019-11-12 10:12:47.903:INFO::main:
Logging initialized #385ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:12:48.154 INFO [WebDriverServlet.] - Initialising
WebDriverServlet 10:12:48.252 INFO [SeleniumServer.boot] - Selenium
Server is up and running on port 33226
Waiting on this line too much. After that, I aborted the manual pipeline. Because the process does not continue.
Error:
Selenium exited before it could start
Error image:
This error message...
10:12:48.252 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 33226
Error: Selenium exited before it could start
...implies that the Selenium Server can't be started for some reasons (e.g. port 4444 is blocked).
As per the discussion Selenium exited before it could start this error can be observed when Selenium Server is started in another process before running npm/wdio and hence selenium standalone service will fail to start.
Solution
The simplest solution would be to check for a running selenium process or try killall selenium / java processes.

Node is not accessible from hub in selenium grid

I just started the hub on my local machine using the following command.
java -jar selenium-server-standalone-3.12.0.jar -role hub
it started successfully, then I have tried to connect a node to another machine using the following command.
java -Dwebdriver.chrome.driver=d:\sel\new\chromedriver.exe -jar selenium-server-standalone-3.12.0.jar -role node -port 5566 -hub http://"HUbip":4444/grid/register
it has shown me The node is registered to the hub and ready to use in the console.
but when I opened Http://"HUbip":4444/grid/console it has shown the IP and 5 chrome browser, 5 Firefox, 1 internet explorer logos. But at the top of that, the text has shown like "DefaultRemoteProxy unknown version, Failed to connect to Ip of the node".
so when I have tried to run the test I am getting an error like "Could not start a new session. Possible causes are the invalid address of the remote server or browser start-up failure.
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'".
I have already switched off both machine's firewall. and tried to telnet from the node to hub, it was a success.
I am unable to rectify the issue. someone, please suggest a solution.
Add in Selenium Grid Extras which can help you with the management of Selenium Grid like :
Restart the node/hub
Clear session
Recommends the defaults for the ports
You'll need to run the setup on the hub and node:
java -jar SeleniumGridExtras-*.*.*-SNAPSHOT-jar-with-dependencies.jar
Note: You're not using the standard port for the node 5555.

Jenkins can't launch real browser on Ubuntu 16.04

I've selenium script which launches chrome browser, goes to a website and does basic checks.
When I tried running same script locally through jenkins I got error
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.13.0-17-generic x86_64)
This is resolved by Unknown error: Chrome failed to start: exited abnormally
I'm confused why Jenkins can't launch real chrome browser on Ubuntu ?
Because Jenkins server normally does not have a graphical subsystem installed in the operating system. When a real browser (or any app) tries to create a window that fails.
You will need to run your tests on Jenkins using a headless browser - one that does not need a graphical subsystem. Chrome-headless is currently the preferred option, replacing the now abandoned PhantomJS.

Selenium Grid Node is repeatedly registering with the hub (Selenium 3.3)

I run this command on a virtual machine to register a node with my Selenium Grid hub:
java -Dwebdriver.ie.driver=C:\IEDriverServer.exe -Dwebdriver.chrome.driver=C:\chromedriver.exe -Dwebdriver.gecko.driver=C:\geckodriver0-15-0.exe -jar selenium-server-standalone-3.3.0.jar -role node -port 5555 -hub http://10.201.1.201:4444/grid/register -browser "browserName=internet explorer, version=10, platform=WINDOWS, maxInstances=5" -browser "browserName=chrome,maxInstances=5,platform=WINDOWS" -browser "browserName=firefox,maxInstances=5,platform=WINDOWS"
As a result, the node seems to connect correctly, but every minute or so I see
"Registering the node to the hub: [hub ip]
The node is registered to the hub and ready to use."
This doesn't seem to cause any errors with my tests, but I'm curious why it is repeatedly trying to register. I believe this started when I upgraded Selenium Server Standalone to 3.3.
I'm also noting that from my hub, I see that it keeps "marking the node as down because it can't be reached for 2 tries". Then it immediately registers that node again, and then it's down again, repeated forever.
There is a bug that should be fixed in version 3.3.1. It seemed to produce the same problem you're seeing. If it still doesn't work I'd recommend commenting on the github issues.

Selenium Grid - For Chrome browser when selenium node is run as a Windows service, I get InitSession unknown error: unable to discover open pages

I am a Selenium newbee. In fact I am covering for another automation tester.
I am trying to setup Selenium Grid, I have successfully setup Hub and node.
When I run Selenium node as a Windows Service, for chrome browser I get following error.
[0.535][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-logging --ignore-certificate-errors --load-extension="C:\Windows\TEMP\scoped_dir1396_19904\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12964 --safebrowsing-disable-auto-update --test-type --use-mock-keychain --user-data-dir="C:\Windows\TEMP\scoped_dir1396_21178" data:,
[60.676][INFO]: RESPONSE InitSession unknown error: unable to discover open pages
When I run node as a java program in command line (note - without windows service) it works fine.
Service is running as system user and I want to run the service as system user so that browsers don't show up when I remote login to the machine.
I have also tried it using a different admin account, the result is the same.
These are the versions I am using
Selenium 2.53.1
Firefox version 45.2.0
Chrome Version 52.0.2743.82 (Chrome driver 2.22)
These are the commands I run to complete the setup. Note, I am using NSSM to setup Windows Services.
I am setting up node and hub on the same machine for the initial setup.
C:\Selenium\nssm-2.24\win32\nssm.exe install GridHub java -jar C:\Selenium\selenium-server-standalone-2.53.1.jar -role hub
C:\Selenium\nssm-2.24\win32\nssm.exe start GridHub
C:\Selenium\nssm-2.24\win32\nssm.exe stop GridNode
C:\Selenium\nssm-2.24\win32\nssm.exe remove GridNode confirm
C:\Selenium\nssm-2.24\win32\nssm.exe install GridNode java -Dwebdriver.chrome.driver="C:\Selenium\chromedriver-2.22\chromedriver.exe" -Dwebdriver.ie.driver="C:\Selenium\iedriver-2.53.1\IEDriverServer.exe" -jar C:\Selenium\selenium-server-standalone-2.53.1.jar -role webdriver -hub http://x.x.x.x:4444/grid/reg -Dwebdriver.chrome.logfile=C:\Selenium\chromedriver.log
C:\Selenium\nssm-2.24\win32\nssm.exe start GridNode
Any help is appreciated.
When I add no-sandbox option, it works smoothly
This I guess is a bug with Chrome browser itself which needs to be fixed. The no-sandbox option could just be a workaround.
Please follow the below two issues which are raised around this.
https://bugs.chromium.org/p/chromedriver/issues/detail?id=1424
https://bugs.chromium.org/p/chromium/issues/detail?id=615396
I experienced the same.
This is an issue with Chrome 52.
I upgraded to chrome 53 Beta and boom the issue is gone.
Apparently the issue is fixed in chrome version 53