Andrei
Andrei

Reputation: 5637

Browser does not open in Jenkins while executing selenium test

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

Upvotes: 0

Views: 23081

Answers (5)

Purushoth
Purushoth

Reputation: 69

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

Upvotes: 0

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

Upvotes: 3

Rajagopal V
Rajagopal V

Reputation: 26

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

Upvotes: 0

Andrei
Andrei

Reputation: 5637

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 ))

Upvotes: 0

undetected Selenium
undetected Selenium

Reputation: 193058

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();

Upvotes: 0

Related Questions