0

I am trying to start a job in Jenkins, which executes a Selenium script. It was working fine for a few months, but today it is just stopped working for an unknown reason. This job starts the first test as always and then stucks. I am not getting any errors, just nothing happens after this:

TEST STARTED: test
-------------------------------------------------------------------
[main] INFO net.serenitybdd.core.Serenity - TEST NUMBER: 1
März 26, 2019 3:02:23 NACHM. org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 46182
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
März 26, 2019 3:02:25 NACHM. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C

I have realised, that every time I am starting a job with chrome a new Google Chrome processes adds to task manager, so I assume the chrome windows are showing up. Also when I kill this processes, I am getting this:

...
[1553694146.113][SEVERE]: Timed out receiving message from renderer: 10.000
[1553694146.113][WARNING]: screenshot failed, retrying
[1553694156.113][SEVERE]: Timed out receiving message from renderer: 10.000
[1553694166.118][SEVERE]: Timed out receiving message from renderer: 10.000
[1553694166.118][WARNING]: screenshot failed, retrying
[main] WARN net.thucydides.core.webdriver.WebDriverFacade - Failed to take screenshot (unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
 (Session info: chrome=73.0.3683.86)
 (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.17763 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-5QTQGUC', ip: '192.168.178.23', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.1'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 73.0.3683.68 (47787ec04b6e3..., userDataDir: C:\WINDOWS\TEMP\scoped_dir5...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:3697}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 73.0.3683.86, webStorageEnabled: true}
Session ID: da5e7153b21e4cb075843ac4e541ab6f)
[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener -
...

I have tried to update Jenkins and all plugins, updated my browser and webdriver, turned off firewall and antivirus. Nothing helped so far. I am still able to run all test local via ide and have no idea what went wrong with Jenkins, that I am not able to run my tests.

Any ideas, what could went wrong and how to deal with it?

PS it works fine in firefox, but I also need chrome

Andrei Suvorkov
  • 5,559
  • 5
  • 22
  • 48
  • its some time ago but.. check if you leave unexpected instances of the chrome driver on your system.. in my case i was doing a massive test with selenium and the problem was that my script left many dead instances of the chrome driver..even if i tried to recycle the chromedriver instances.. in my case the only solution was to dirty work around that, Also in my eyes it was very difficult to run selenium tests async, i just want to point out. Hope it brings some helpful informations to you.. Cheers – xzesstence Mar 26 '19 at 14:28
  • A couple things 1) Can we please see the code that the error mentions, where you use `DesiredCapabilities.chrome()`. It would help to see how it is launched. 2) Launch the selenium driver directly, and see if the command prompt that appears stays visible and does not spew errors of any kind. 3) You've restarted this machine, right? 4) All you see on a web browser when opening Jenkins is `ERR_CONNECTION_REFUSED` and nothing else, just as plain text? – Asyranok Mar 26 '19 at 16:05
  • @Asyranok 1) if you mean `ERR_CONNECTION_REFUSED` it happens, when I try to open `Jenkins` webpage. It has nothing to do with `DesiredCapabilities.chrome()` I think. 2) I have launched. No errors. 3) Yes, I have restarted. 4) the full messge is like this (`The website is unavailable localhost has refused the connection. Try the following: Check connection Check Proxy and Firewall ERR_CONNECTION_REFUSED`) – Andrei Suvorkov Mar 27 '19 at 07:09
  • I am using Firefox 98.0.1 (64 bit) and my selenium tests invoked from Jenkins build are not launching browser. Same behaviour is on Chrome. All tests are passing and maven surefire plugin reports are perfectly fine. I feel like it is something to do with Jenkins launching headless browser. – Vikas Piprade Mar 22 '22 at 10:27

5 Answers5

2

For Windows:

I would like to add when Jenkins shall show running automation test cases in browser.

First, you should not install Jenkins as windows application. Even if you do so but Do not enable the checkbox "Allow service to interact with desktop" under Log On Tab, then Jenkins would not be showing running test cases in browser. where to find this tab -

1) In windows, service select the service of Jenkins

2) Open properties window of the service -> Logon-> enable the checkbox "Allow service to interact with desktop"

3) you have to toggle the NoInteractiveServices registry key

4) After then you should reboot the service, Jenkins.

Best Approach You shall deploy Jenkins from a war file as follows:

1) Download Jenkins.war from Jenkins's official site. (If already installed just go to the folder where Jenkins has installed default path as "C:\Program Files (x86)\Jenkins\")

2) Deploy it by the command prompt : java -jar {directoryOfJenkinsFileInWindows}/jenkins.war

3) Now you can access Jenkins administration on http://localhost:8080

Cherry
  • 175
  • 1
  • 6
TheSociety
  • 1,936
  • 2
  • 8
  • 20
  • Thank you very much, now I am able to run Jenkins. Somehow it was disabled in windows services. I have rebooted it in windows services and it worked. But the main problem is not solved yet – Andrei Suvorkov Mar 27 '19 at 07:21
0

This error message...

März 26, 2019 3:02:23 NACHM. org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 46182
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
März 26, 2019 3:02:25 NACHM. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C

...implies that you have used an instance of DesiredCapabilities() class and casted for chrome but when the session was created the dialect detected was W3C

As a general consciousness:

  • Chrome and ChromeDriver is OSS complaint
  • Whereas GeckoDriver / Firefox and IEDriverServer / Internet Explorer is W3C complaint.

Your code block would have helped us to debug the issue in a better way. Perhaps though you have used DesiredCapabilities() class and casted for chrome but while initializing you have invoked the FirefoxDriver() as:

WebDriver driver =  new FirefoxDriver();

Solution

Change the initialization of WebDriver as:

WebDriver driver = new ChromeDriver();
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I am using default settings from this template project https://github.com/hypery2k/serenity_sample . As you can see webDriver instance is setting up automatically, I just peek `chrome` or `firefox` in `serenity.properties`. It was working well for a couple of months. I have tried to run my job with `firefox` and it worked well. But I also need `chrome` – Andrei Suvorkov Mar 27 '19 at 09:21
  • @AndreiSuvorkov The summary is Chrome and ChromeDriver is **OSS** complaint whereas Firefox and IE is **W3C** complaint. – undetected Selenium Mar 27 '19 at 09:26
0

So. I have found an issue and it is a Chronium bug. More information can be found here. I will try to downgrade webdriver and chrome to older version and will share the result.

EDIT: I have downgraded my Chrome to Version 72.0.3626.81 and chromedriver to ChromeDriver 2.46. It works well.

NOTE: I found a bit tricky to prevent Chrome from auto-update to the newest version. Here you can found some useful tipps how to deal with it. I personally choose folder rename ))

Andrei Suvorkov
  • 5,559
  • 5
  • 22
  • 48
  • One thing I want to mention here ... If you are running tests from eclipse maven project , it's using maven embedded in eclipse . And for Jenkins probably you are using maven which is installed on node. Both times, while running project from eclipse and Jenkins, it's using different version of maven. There could be some unknown issue in maven and that's why it's launching browser locally and not from Jenkins. – Vikas Piprade Mar 22 '22 at 12:31
0

Mostly it is due to compatibility issue (selenium and chrome driver version). Please refer to http://chromedriver.chromium.org/downloads

Selenium Timed out receiving message from renderer

0

Working Solution - Install Jenkins by Downloading Generic Java Package(.war), after installation the browser will open automatically when running selenium tests.

https://www.jenkins.io/download/

Please refer the below URL for installing Jenkins that supports opening browsers and run tests. https://itsforlavanya.blogspot.com/2020/08/jenkins-installation-install-jenkins-in.html

enter image description here

Purushoth
  • 59
  • 4