WebDriver randomly closes connection during screenshot - selenium

I don't know exactly how to replicate this error, but I do a lot of screenshots of the pages with WebDriver. Sometimes, suddenly I get this exception:
org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9958
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '*******-*******', ip: '***.***.*.**', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.1'
Driver info: driver.version: ExtendedWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
at org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(RemoteWebElement.java:392)
...
I don't quit/close the driver before that happens, and previous commands right before getScreenshotAs work as expected. It only happens with getScreenshotAs command. Never had this problem with any other. It's very rare though. I had this error maybe 20-30 in total. For example I run tests all night, then in 3 nights I get this error once.
Is this a known issue? I'm using ChromeDriver most of the times.
I didn't specify any related code, because it happens regardless. I use stock version of ChromeDriver and selenium java library both version 3.141.59.

Related

Getting error "It is impossible to create a new session because 'createSession' which takes HttpClient"

I am not able to launch the Notepad.exe via windows application driver with selenium and Appium
Below are the versions of all
**Appium** : 1.15.1
**Selenium Standalone** : 3.141.59
**Java Client** : 7.2.0
I am starting Windows application driver server like this WinAppDriver.exe 4727.
I have tried this using testng and junit both,but getting the same error again and again.
Error Message is below :
org.openqa.selenium.WebDriverException: It is impossible to create a
new session because 'createSession' which takes HttpClient,
InputStream and long was not found or it is not accessible Build info:
version: '3.12.0', revision: '7c6e0b3', time:
'2018-05-08T14:04:26.12Z' System info: host: 'DESKTOP-0TL6S7C', ip:
'172.18.2.139', os.name: 'Windows 10', os.arch: 'amd64', os.version:
'10.0', java.version: '1.8.0_221' Driver info: driver.version:
WindowsDriver
You mentioned in the question about using Selenium Standalone v3.141.59 but as per the error trace logs:
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
Which is almost 2 years old.
Upgrading your build with Selenium Standalone v3.141.59 will solve the issue.

Getting org.openqa.selenium.remote.UnreachableBrowserException for Chrome

I am getting this error and I have checked the documentation and even the basic program on the documentation page is giving this error.
chromedriver : 2.44
chrome version : 74
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27
09:10:26'
System info: host: 'HIDINGACTUALHOST', ip: '10.10.10.10', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0',
java.version: '1.8.0_211'
Driver info: driver.version: Driver
As you have mentioned you are using chrome driver 2.44 which is only supported chrome v69-v71.
You need to download chrome driver 74 for chrome v74
Note : You can see all the details related chrome driver here

net.thucydides.core.webdriver.UnsupportedDriverException: Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

I am using mac mojave 10.14.3, JDK 1.8, Serenity core 2.0.40 (latest) to develop my test cases. They all run perfectly well either with Chrome ver. 73(100% of time) or Firefox ver. 65.0(99% of time) on my local mac system.
Our Jenkins is running on Redhat linux with no GUI. We installed Firefox browser( Firefox version 60.5.0 probably the latest available) since Chrome is not supported/ unavailable for RH Linux. When I merged code and ask my admin to run the git branch on Jenkins, I always get errors.
I have these in my project code itself:
Selenium-java :3.141.59
Selenium-api: 3.141.59
Selenium-server: 3.141.59
geckodriver:0.24.0
chromedriver:2.45.615355
Today after every test running 100% pass on my local Mac system, ran on Jenkins(RH Linux box) I am getting this error (ran 2 times).
net.thucydides.core.webdriver.UnsupportedDriverException: Could not
instantiate class org.openqa.selenium.firefox.FirefoxDriver at
net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:154)
Caused by: net.thucydides.core.webdriver.UnsupportedDriverException:
Could not instantiate new WebDriver instance of type class
org.openqa.selenium.firefox.FirefoxDriver (Timed out waiting 45
seconds for Firefox to start. Build info: version: '3.141.59',
revision: 'e82be7d358', time: '2018-11-14T08:17:03'
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
45 seconds for Firefox to start. Build info: version: '3.141.59',
revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
'xxx', ip: 'xxx', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.10.0-957.5.1.el7.x86_64', java.version: '1.8.0_202' Driver info:
driver.version: FirefoxDriver
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
45 seconds for Firefox to start. Build info: version: '3.141.59',
revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
'xxx', ip: 'xxx', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.10.0-957.5.1.el7.x86_64', java.version: '1.8.0_202' Driver info:
driver.version: FirefoxDriver at
org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:247)
*********POSSIBLY A BUG ?????**
According to this page, [Serenity BDD Book]https://serenity-bdd.github.io/theserenitybook/latest/web-testing-in-serenity.html
I prepared my config.properties file as ...
Chrome Browser Headless Testing
webdriver.driver=chrome
headless.mode = true
drivers.windows.webdriver.chrome.driver =
src/test/resources/webdriver/windows/chromedriver.exe
drivers.mac.webdriver.chrome.driver =
src/test/resources/webdriver/mac/chromedriver
drivers.linux.webdriver.chrome.driver =
src/test/resources/webdriver/linux/chromedriver
Firefox Browser Headless Testing
webdriver.driver=firefox
gecko.firefox.options = {"args": ["-headless"]}
drivers.mac.webdriver.gecko.driver =
src/test/resources/webdriver/mac/geckodriver
drivers.linux.webdriver.firefox.driver =
src/test/resources/webdriver/linux/geckodriver
But I was having problem as reported above UnsupportedDriverException:
I need to say, everything worked perfectly on my local Mac system, but NOT on RedHat Linux machine with Firefox browser 60.5 version (which should work with geckodriver 0.24.0)
But our Jenkins System Admin added the geckodriver to system path, then it WORKED !!!!!
Our Jenkins Server is running on RedHat Linux.

How to configure web driver codeception in yii2 with selenium

I'm so confusing with this problem. So anyone who has taken the same trouble like this, please kindly inform me.
[Facebook\WebDriver\Exception\UnknownServerException]
Error communicating with the remote browser. It may have died.
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03
:16'
System info: host: 'DESKTOP-KLV8HD0', ip: '192.168.2.168', os.name: 'Window
s 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: RemoteWebDriver
How to resolve ? Here is the description of application that I used:
Google Chrome (62.0.3202.75) -> Updated new version for now
Chrome Driver (2.9) -> Updated by http://chromedriver.storage.googleapis.com/index.html (I thought 2.9 version is newer version)
selenium-server-standalone-2.47.1

Selenium Tests not working on Jenkins with Chromedriver, Chromium and xvfb

im trying to get a bunch of selenium tests to work on my Jenkins. Its an Ubuntu machine and i installed Chromedriver Chromium and xvfb.
After some problems it seems like its finding my chromedriver and the xfvb now but i still cant get any tests to run. They work fine local but now on Jenkins it says :
Fehlermeldung
Timed out after 5 seconds waiting for visibility of element located by By.xpath: //*[#id='loginForm-loginUsernameInput']
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-39-generic', java.version: '1.7.0_67'
Driver info: driver.version: unknown
Stacktrace
org.openqa.selenium.TimeoutException: Timed out after 5 seconds waiting for visibility of element located by By.xpath: //*[#id='loginForm-loginUsernameInput']
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-39-generic', java.version: '1.7.0_67'
Driver info: driver.version: unknown
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:255)
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:270)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:222)
Im wondering why it doesnt show the chromedriver Version? Like version unknown? Im running the xvfb and the chromedriver in the background and im not using Jenkins to start it. I tried it with letting Jenkins start chromedriver and set the path -Dwebdriver.chrome.path=
but that results in the same error. Does anyone have a idea about this? I tried quite a few things but im still wondering if its the chromedriver that is not working or whats the Problem? Im using ChromeDriver v2.9.248304
You are using a very outdated version of Selenium. Typically, the newer Chrome versions might not work with older version of Selenium.
Try updating to Selenium version 2.44.0
I'm willing to bet this will fix your issue.