I've setup Jenkins server on windows 10 machine. When running the job(simply mvn test -DsuiteXmlFile=%TestSuite%) the job successfully compiles and starts tests. I can see first being skipped, second failed and then it starts passing one after one. No Chrome window is opened, but when I check in task manager I can see it opens several Chrome processes in background. When calling mvn test -DsuiteXmlFile=TestSuite in CMD(also in power shell) it opens Chrome in front.
Looking at Jenkins logs I see that it creates a .bat file in c:/System/TEMP/ directory and executes that batch file. I've even tried to copy the file, put in my project's root and call it via CMD, the same .bat file works as expected. Still jenkins opens Chrome in background. Any idea what causes this and how can I force Jenkins to run tests in Foreground?
My chromedriver vesion is 78.0.3904.70(if needed).
Logs are identical for both cases:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
18.11.2019 03:50:38.019 INFO - [AutomationListener]:Staring to run test suite with 11 tests
Nov 18, 2019 3:50:38 AM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904#{#800}) on port 39924
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1574077841.726][WARNING]: Timed out connecting to Chrome, retrying...
Nov 18, 2019 3:50:43 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[1574077845.835][WARNING]: Timed out connecting to Chrome, retrying...
18.11.2019 03:50:55.489 INFO - [BasePage]:The element: By.cssSelector: polygon is clicked
18.11.2019 03:50:55.494 INFO - [AutomationListener]:----------------------------------------------------------------------
18.11.2019 03:50:55.495 INFO - [AutomationListener]:Starting to run TestMethod test method
18.11.2019 03:50:55.495 INFO - [AutomationListener]:----------------------------------------------------------------------
When the Jenkins slave run as service in the background every program it initiate, like running the batch file, will also be in the background. The solution is to run the Jenkins slave as a regular program in the foreground.
Yes, the slave solution is working in my case.
I have also a window machine, I have configured the Jenkins and also configured the slave within the machine and now it every time opens the browser in the foreground.
I know it's not the genuine solution but it works perfectly
Related
I try to run grunt test, and Selenium exits without closing the browser. I am unable to see where the exception is coming from.
grunt test
Running "protractor_webdriver:start" (protractor_webdriver) task
Starting Selenium server
Started Selenium server: http://127.94.0.1:4444
Running "protractor:projecttest" (protractor) task
[10:16:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[10:16:33] I/launcher - Running 1 instances of WebDriver
Session created: count=1, browserName=chrome
......Exception thrown: Going to shut down the Selenium server
Shutting down Selenium server: http://127.94.0.1:4444
Shut down Selenium server: http://127.94.0.1:4444 (OKOK)
Fatal error: 10:16:45.529 WARN - Exception thrown
All of my tests are passing. I even added logs to prove the final test passes and exits without exception.
I tried to up my logging from "dots" to "progress" but it doesn't change anything. Any ideas?
09:39:51.984 INFO - Got result: Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser on session null
09:39:52.002 INFO - Command request: getNewBrowserSession[*firefox, http://website.localhost] on session null
09:39:52.002 INFO - creating new remote session
09:39:52.003 INFO - Allocated session 4b3951d894ed4a2c94b7fd9758cd5554 for http://website.localhost, launching...
jar:file:/usr/bin/selenium-server-standalone-2.41.0.jar!/customProfileDirCUSTFFCHROME
09:39:52.071 INFO - Preparing Firefox profile...
09:40:12.129 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Timed out waiting for profile to be created!
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:307)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:119)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:89)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:346)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:114)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:400)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:144)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:105)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:809)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:435)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:405)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:151)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
09:40:12.131 INFO - Got result: Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser on session null
09:40:12.143 INFO - Command request: getNewBrowserSession[*firefox, http://website.localhost] on session null
what i am doing ?
Step 1: Start the hub
The Hub is the central point that will receive all the test request and distribute them the the right nodes.
Open a command prompt and navigate to the directory where you copied the selenium-server-standalone file. Type the following command:
java -jar selenium-server-standalone-2.14.0.jar -role hub
Step 2: Start the nodes
Regardless on whether you want to run a grid with new WebDriver functionality, or a grid with Selenium 1 RC functionality, or both at the same time, you use the same selenium-server-standalone jar file to start the nodes.
java -jar selenium-server-standalone-2.14.0.jar -role node -hub http://localhost:44444/grid/register (here 44444 is for the environment i am working)
This is due to compatibility issues between selenium and firefox.
You need to upgrade to the latest selenium server, 2.44 at the moment.
Yes! As alec[xe suggested this is due to the compatibility issues between firefox and selenium. For firefox version higher than 30 you must use selenium 2.44 version.Here's the changelog of the selenium please take a look and decide which version of the selenium will fulfill your requirement.
Click here to download the latest(2.44) version of the selenium.
We are trying to run the web-component-tester however it keeps stalling on the Selenium step.
When I run wct -l chrome --verbose
I get the following
hook: prepare
hook: prepare:selenium
hook done: prepare:selenium
Starting Selenium server for local browsers
11:47:46.357 INFO - Launching a standalone server
Setting system property webdriver.chrome.driver to C:\Users\<user>\AppData\Roaming\npm\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone\.selenium\chromedriver\2.13-x64-chromedriver
Setting system property webdriver.ie.driver to C:\Users\<user>\AppData\Roaming\npm\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone\.selenium\iedriver\2.44.0-x64-IEDriverServer.exe
11:47:46.809 INFO - Java: Oracle Corporation 25.31-b07
11:47:46.809 INFO - OS: Windows 7 6.1 x86
11:47:46.872 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
11:47:47.669 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:11655/wd/hub
11:47:47.669 INFO - Version Jetty/5.1.x
11:47:47.685 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:47:47.919 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#3c1e69
11:47:47.919 INFO - Started HttpContext[/wd,/wd]
11:47:47.919 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:47:47.919 INFO - Started HttpContext[/,/]
11:47:47.935 INFO - Started SocketListener on 0.0.0.0:11655
11:47:47.935 INFO - Started org.openqa.jetty.jetty.Server#11bc7ed
Then after a few minutes of stalling it follows up with
hook done: prepare with error: [Error: Unable to connect to selenium]
Error: Unable to connect to selenium
Running these same tests from the browser works without a problem.
While it has hanged, we can still connect via browser to http://127.0.0.1:11655/wd/hub
I've tried Googling but not a lot of luck.
What are the things that could go wrong or how can I debug this further?
One of the node modules doesn't use the Internet Explorer proxy values.
In your environment variables, create a new one
Name : no_proxy
Value : localhost, 127.0.0.1
Don't forget to restart your shell session after applying
I had the same issue and was due to the proxy setting of my org. When i went out of my org's network and connected through internet, i was able to run the tests through selenium. I have not yet able to find a way through the proxy settings as of now. I was running on mac. You might need to try through normal internet setup and check.
I'm trying to set up a simple Selenium test in Jenkins. My OS is Debian GNU/Linux 6.0.7 (squeeze), desktop version (64-bit). I uninstalled the supplied browser iceweasel and intalled Firefox with aptitude. The firefox version is "20.0". I also have Google Chrome installed. I can run Firefox by writing "firefox" in a terminal window.
Jenkins is installed with aptitude.
So, I have installed a plugin in Jenkins called Seleniumhq. These are my settings:
I then receive an error in the Jenkins console when I try to build:
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/selenium2
java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar -trustAllSSLCertificates -htmlSuite *firefox http://site.com /var/lib/jenkins/jobs/Selenium1/suites/suite1.html /var/lib/jenkins/jobs/Selenium1/logs/selenium.html
[selenium2] $ java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar - trustAllSSLCertificates -htmlSuite *firefox http://site.com /var/lib/jenkins/jobs/Selenium1/suites/suite1.html /var/lib/jenkins/jobs/Selenium1/logs/selenium.html
13:32:18.507 INFO - Java: Sun Microsystems Inc. 14.0-b16
13:32:18.508 INFO - OS: Linux 2.6.32-5-amd64 amd64
13:32:18.512 INFO - v2.0 [b2], with Core v2.0 [b2]
13:32:18.604 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
13:32:18.605 INFO - Version Jetty/5.1.x
13:32:18.606 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:32:18.606 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:32:18.607 INFO - Started HttpContext[/,/]
13:32:18.616 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#488e32e7
13:32:18.616 INFO - Started HttpContext[/wd,/wd]
13:32:18.621 INFO - Started SocketListener on 0.0.0.0:4444
13:32:18.621 INFO - Started org.openqa.jetty.jetty.Server#5a5e5a50
HTML suite exception seen:
java.lang.RuntimeException: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ''firefox-bin' or 'firefox'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3/blah/blah/firefox-bin
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(Bro wserLauncherFactory.java:160)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(Browse rLauncherFactory.java:99)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.getBrowserLauncher(HTMLLauncher.java:58)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:114)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:557)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:250)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:210)
Caused by: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ''firefox-bin' or 'firefox'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3/blah/blah/firefox-bin
at org.openqa.selenium.browserlaunchers.locators.Firefox2or3Locator.findBrowserLocationOrFail(Firefox2or3Locator.java:26)
at org.openqa.selenium.server.browserlaunchers.BrowserInstallationCache.locateBrowserInstallation(BrowserInstallationCache.java:27)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.<init>(FirefoxLauncher.java:52)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:153)
... 7 more
Finished: SUCCESS
I also tried to put this in the browser field:
*firefox/usr/bin/firefox
I think firefox is installed there (i ran "locate firefox").
That config renders another error msg:
...
HTML suite exception seen:
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox
Supported browsers include:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
....
Does anybody have ideas about how to fix this?
Thanks!
Edit
I changed the browser settings to this:
*firefox /opt/firefox/firefox (with a space between)
Now it seems FIrefox can be found, but I receive another error:
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/selenium2
java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar -trustAllSSLCertificates -htmlSuite *firefox /opt/firefox/firefox http://site.com /var/lib/jenkins/jobs/selenium2/suites/suite1.html /var/lib/jenkins/jobs/selenium2/logs/selenium.html
[selenium2] $ java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar - trustAllSSLCertificates -htmlSuite "*firefox /opt/firefox/firefox" http://site.com /var/lib/jenkins/jobs/selenium2/suites/suite1.html /var/lib/jenkins/jobs/selenium2/logs/selenium.html
10:51:15.567 INFO - Java: Sun Microsystems Inc. 14.0-b16
10:51:15.569 INFO - OS: Linux 2.6.32-5-amd64 amd64
10:51:15.572 INFO - v2.0 [b2], with Core v2.0 [b2]
10:51:15.668 INFO - RemoteWebDriver instances should connect to: http: //127.0.0.1:4444/wd/hub
10:51:15.669 INFO - Version Jetty/5.1.x
10:51:15.669 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
10:51:15.670 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:51:15.670 INFO - Started HttpContext[/,/]
10:51:15.680 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#3da99561
10:51:15.680 INFO - Started HttpContext[/wd,/wd]
10:51:15.685 INFO - Started SocketListener on 0.0.0.0:4444
10:51:15.685 INFO - Started org.openqa.jetty.jetty.Server#182d9c06
10:51:15.743 INFO - Preparing Firefox profile...
HTML suite exception seen:
java.lang.NullPointerException
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:259)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirec tory(FirefoxChromeLauncher.java:117)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:84)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:406)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:106)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:121)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:557)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:250)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:210)
10:51:35.789 INFO - Shutting down...
Finished: SUCCESS
Well, I found a good tutorial that turned out to be useful. One important thing is to start a virtual X window on a server where Selenium can start the browser in to run your tests (Xvfb). And in Jenkins the server should be entered just like "*firefox".
http://alex.nederlof.com/blog/2012/11/19/installing-selenium-with-jenkins-on-ubuntu/
You should try to run the commandline from a shell and see what happen. It's certainly a problem linked to the default profile used by the firefox instanciated by selenium.
In my case the problem was that firefox was starting by displaying the tabs that could be restored.
You can also try to create a specific profile :
firefox -p
or
firefox -ProfileManager
then use this dedicated profile using command line parameter :
-firefoxProfileTemplate /home/userXXX/.mozilla/firefox/ljhyckqd.Selenium
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox
Wrong syntax. try *firefox or *firefox [insert directory]
I have Selenium running under Cruise Control to test our site once a day. On Saturday Selenium started throwing the error below.
No code was changed between the tests running sucessfully on Friday night. Also, the same thing has happened on three different machines so I assume it must be something on the machine such as windows updates. I can't see that any were deployed though.
How would I go about debugging this?
java -jar selenium-server.jar -port 4445
14:00:35.375 INFO - Java: Sun Microsystems Inc. 14.3-b01
14:00:35.375 INFO - OS: Windows 2003 5.2 x86
14:00:35.390 INFO - v1.0 [2677], with Core v#VERSION# [#REVISION#]
14:00:35.500 INFO - Version Jetty/5.1.x
14:00:35.500 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
14:00:35.515 INFO - Started HttpContext[/selenium-server,/selenium-server]
14:00:35.515 INFO - Started HttpContext[/,/]
14:00:35.531 INFO - Started SocketListener on 0.0.0.0:4445
14:00:35.546 INFO - Started org.mortbay.jetty.Server#dbe178
14:00:42.812 INFO - Checking Resource aliases
14:00:42.843 INFO - Command request: getNewBrowserSession[*iexplore, http://test.com/, ] on session null
14:00:42.859 INFO - creating new remote session
14:00:42.968 INFO - Allocated session 1e1f23e664184a3ebdd30c06c4759960 for http://test.com/, launching...
14:00:42.968 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.IllegalArgumentException: Resource not found: /core
at org.openqa.selenium.server.browserlaunchers.ResourceExtractor.extractResourcePath(ResourceExtractor.java:39)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(HTABrowserLauncher.java:85)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launch(HTABrowserLauncher.java:60)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launchRemoteSession(HTABrowserLauncher.java:140)
at org.openqa.selenium.server.browserlaunchers.InternetExplorerLauncher.launchRemoteSession(InternetExplorerLauncher.java:77)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:357)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:122)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:84)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:697)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:394)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:365)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:126)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
14:00:42.968 INFO - Got result: Failed to start new browser session: Error while
launching browser on session null
14:00:43.046 INFO - Command request: testComplete[, ] on session null
14:00:43.046 INFO - Got result: OK on session null
I've had a similar problem. No matter what browser I was trying to launch, it sit there for a while (with the process started, but no visible window), and then eventually fail.This was on Windows 7, executing the tests through java.
It turned out I just needed to end all other browsers. I couldn't have IE, Firefox, or chrome open at the time of testing. Maybe you should try that? Good luck!
I upgraded the Selenium RC server to 1.0.3 (released 23 Feb 2010) and the tests started working again! I don't know what the issue was, but that fixed it.