Selenium web driver JS : ECONNRESET socket hang up - selenium

When i am trying to do UI automation testing in AWS Code build getting this error
Error: ECONNRESET socket hang up
at ClientRequest. (node_modules/selenium-webdriver/http/index.js:294:15)
I am using standalone selenium docker for firefox inside AWS Code build with linux environment.
Same script is working in local machines

Please verify selenium running on port 4444

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.

Selenium works when started locally, but not remotely

I'm hoping this is a simple issue to solve:
I have a dedicated machine that runs selenium with chromedriver. I can physically walk to the machine and type the following in a local terminal:
java -Dwebdriver.chrome.driver=chromedriver238 -jar selenium-server-3.11.jar
I can then go to any other machine on the network and kick off testing (in my case, codeception on jenkins) and it will sucessfully run my tests in chrome without a hitch.
However, if I try to run the above command without physically being at the selenium machine (ex, trying to ssh into the machine to run the command or making this command run as part of a supervisor process) then selenium has trouble starting the instance of chrome.
Has anyone run into this scenario before? Is there a way I can give 'interactive' access to the background script to allow it to open stuff on my screen?
Because when you physically walk to the machine and run the command. the selenium can get the desktop/window interface.
When use SSH, selenium lost the desktop/window interface, selenium have to start chrome under headless model, but your code not config to run as headless model. So the conflict come out.
you need to config your code to run with headless model.
I'm to getting the same scenario, when i try to start the selenium code on the machine A it works yet when i try to start selenium and run the scripts from machine B
(remotely connecting to machine A using ssh [ssh test#machine-a]) chrome instance doesn't start/launch and driver is getting null.
logs :
2020-02-27 12:04:27,319 INFO [LogWritter] Exception in beforeclass chrome driver instantiation , driver is null
2020-02-27 12:04:27,493 INFO [LogWritter] Exception in getting screenshot---java.awt.AWTException: headless environment
Any help/suggestion would be great !

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 Docker

I am using selenium with dockers in a Debian VM without GUI and I am having problems to get the web elements. If I launch the selenium server as a jar in my machine works like a charm.
This is the error that I am getting:
java.lang.ClassCastException:
com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to
org.openqa.selenium.WebElement
Any ideas? Is it necessary to have a VM with GUI?

How To Run UI Test Classes Using Selenium Webdriver in Jenkins?

I have test classes written in java for UI testing using Maven using Selenium Web-Driver. I want to run them using mvn test command in Jenkins.
It is not able to launch the browser for the testing.
The error stack shown is something like this:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
Any help on this will be appreciated.
Firefox needs a X display to run, e.g. Xvfb
You will need to
install xvfb on your server. Doing this depends on your server operating system (and package management)
start xvfb before the build. You can do this using the xfvb plugin, or by running Xvfb as a daemon. I personally like to use the plugin.