moveMouse() selenium gives error - php

I have used selenium 2.53.3 with nodejs.
to move mouse to particular button I have used
mouseMove(elem) function. ex:
driver.actions().mouseMove(elem).click().perform();
Some time it works and some time it not, what is the matter.
Some time I have got following error:
POST /session/67809eeb-fa66-489d-84de-ab8426e6c796/moveto did not match a known command Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: '185-129-70-172', ip: '185.129.70.172', os.name: 'windows', os.arch: 'x86', os.version: '6.2', java.version: '1.8.0_101' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{raisesAccessibilityExceptions=false, browserstack.selenium.jar.version=3.0.1, appBuildId=20161104212021, moz:firefoxOptions={args=[], profile=UEsDBBQACAgIAKQ4MEoAAAAAAAAAAAAAAAAHAAAAdXNlci5qc51Xy27jNhTd9ysKr1qgZpNJZ9Ou0kwGKDBoinGDWRIUeWUxpkiWD8v++15S0vilh52VJZnkfZ1z72H04Kh1UP60KJxp8I14VkJ+lnpNaqYa5oCAZoUCsfjlx5IpDz//8UM87BQs4BprXEhbKmAqVO07wUVbyWf295YrUBbco7WeaNjik9+gN1v413ySfoN7F8xaJTkL0uhfd8rvFqcHaQiNcRtShWCJraSv9sv0t2XeLxXodajwlA8fPw7bd8AE/ggIwAOIz9L58IhBcQW4Lbh4HrepMUE7yitnaqCeO2kDdVHTIOu05eFu2FBghSeYV/2in5TxMJ0WYRqtDBNoS7N1qlBlmm8V6BWmPaV8eLtFp2zwyRitjWBqpoiwDcYoT8A547jR3qjjul2G7+VaG41Zq6EuwK3yq5+OxYP3WDwfDILKgY+YtxIdpdwxX90OD2NBf5a5PnPg6I9RUrf7KOwCOM1UwsTNiC4TOr5GPexzA4VwEp2kjHNAVESNCfSIKsrBhZksCemtYnsQz/d3q78NIjAF+NvwYvwkXvQ3qREn/v6OSLRkXr9+ySkpTAy/F4rpzeISu21ElClF3zxmIzkq2xJeVntnJZYN15KmkgGU9AEP+C9KN4aoBKeNDKRjZY9eDC5hatDI9xoxrAwSaRqyPuE/WlIh+yyeTRtQPDExulTTxVnIqdw6o49EixUGojG15f4Vl4wYAB6dDPvMVbqV0CAcaC13IDIJqdF8hLwTCIo2sfl5MrLecInYxifig5M8UOPkWmpqDQJ9P40hDQ0yn3SpmADCiaPtySR9XMWilpmt/+SPjxnI182AwWMmI/7eILqapnriypEGeuAwhtlk6F+S2JQlroMlSx0DgYv1KvZUQMmiCsMdrU8797aD3jXAAI1oTchogG2GN1xibxLZPXWQZ9hdg9uTtpvn9R/m1k6TZtj1/BnmUN3n//n1yyN5IOwAictkvrEta0fi5BQ5L3xP5mnUXgbt4C1P7UkjLSnS8bckSQHbXp+jo1KzGJJ0SYZWHOGaOuv93dikaD2iGifYFihOOB2GW/GAjHhBLsy6UyjDN7lxvzv4m/vknBxgjlcdJeZUUE1aphMRazuJKWT8VTQ7gbPBGjgphgfTRUM+78QPw0q0HXrLvhUhyEOcGf7d2pE220nOea15pEB8llkHBYLtOOaRN5m5BN5hJ46YbVrFkDnxl35qVePgySfaHENYosTUyNi0fYm6bpmEVfbqnCGTHWs8TZ3OoHlMiJj3pMF7c0e/til6FKiK8Ar45lM7ZP5s/7ldvRAmhEypYTPTe/DS9t7LmjLrdfrYif/JeX3UVnLETziesHEVUqUkarmughpRKKep9kkfBIricqKeR9Z6J98zU2jPcVLjDSRzbJFuLWh2TOymSw5yFq8qM2r30NJU6aNtld5Bh/4PUEsHCEpq6ooxBAAAaQ8AAFBLAQIUABQACAgIAKQ4MEpKauqKMQQAAGkPAAAHAAAAAAAAAAAAAAAAAAAAAAB1c2VyLmpzUEsFBgAAAAABAAEANQAAAGYEAAAAAA==}, platform=XP, specificationLevel=0, browserstack.video.disableWaterMark=true, acceptSslCerts=false, processId=492, browserstack.key=ShpoHTMYgjRnvvprcvm4, browser=firefox, browserVersion=50.0, platformVersion=6.2, acceptSslCert=false, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=firefox, takesScreenshot=true, browser_version=50.0, platformName=windows_nt, 64bit=true, browserstack.debug=false, rotatable=false, browserstack.ie.noFlash=false, firefoxOptions={args=[], profile=UEsDBBQACAgIAKQ4MEoAAAAAAAAAAAAAAAAHAAAAdXNlci5qc51Xy27jNhTd9ysKr1qgZpNJZ9Ou0kwGKDBoinGDWRIUeWUxpkiWD8v++15S0vilh52VJZnkfZ1z72H04Kh1UP60KJxp8I14VkJ+lnpNaqYa5oCAZoUCsfjlx5IpDz//8UM87BQs4BprXEhbKmAqVO07wUVbyWf295YrUBbco7WeaNjik9+gN1v413ySfoN7F8xaJTkL0uhfd8rvFqcHaQiNcRtShWCJraSv9sv0t2XeLxXodajwlA8fPw7bd8AE/ggIwAOIz9L58IhBcQW4Lbh4HrepMUE7yitnaqCeO2kDdVHTIOu05eFu2FBghSeYV/2in5TxMJ0WYRqtDBNoS7N1qlBlmm8V6BWmPaV8eLtFp2zwyRitjWBqpoiwDcYoT8A547jR3qjjul2G7+VaG41Zq6EuwK3yq5+OxYP3WDwfDILKgY+YtxIdpdwxX90OD2NBf5a5PnPg6I9RUrf7KOwCOM1UwsTNiC4TOr5GPexzA4VwEp2kjHNAVESNCfSIKsrBhZksCemtYnsQz/d3q78NIjAF+NvwYvwkXvQ3qREn/v6OSLRkXr9+ySkpTAy/F4rpzeISu21ElClF3zxmIzkq2xJeVntnJZYN15KmkgGU9AEP+C9KN4aoBKeNDKRjZY9eDC5hatDI9xoxrAwSaRqyPuE/WlIh+yyeTRtQPDExulTTxVnIqdw6o49EixUGojG15f4Vl4wYAB6dDPvMVbqV0CAcaC13IDIJqdF8hLwTCIo2sfl5MrLecInYxifig5M8UOPkWmpqDQJ9P40hDQ0yn3SpmADCiaPtySR9XMWilpmt/+SPjxnI182AwWMmI/7eILqapnriypEGeuAwhtlk6F+S2JQlroMlSx0DgYv1KvZUQMmiCsMdrU8797aD3jXAAI1oTchogG2GN1xibxLZPXWQZ9hdg9uTtpvn9R/m1k6TZtj1/BnmUN3n//n1yyN5IOwAictkvrEta0fi5BQ5L3xP5mnUXgbt4C1P7UkjLSnS8bckSQHbXp+jo1KzGJJ0SYZWHOGaOuv93dikaD2iGifYFihOOB2GW/GAjHhBLsy6UyjDN7lxvzv4m/vknBxgjlcdJeZUUE1aphMRazuJKWT8VTQ7gbPBGjgphgfTRUM+78QPw0q0HXrLvhUhyEOcGf7d2pE220nOea15pEB8llkHBYLtOOaRN5m5BN5hJ46YbVrFkDnxl35qVePgySfaHENYosTUyNi0fYm6bpmEVfbqnCGTHWs8TZ3OoHlMiJj3pMF7c0e/til6FKiK8Ar45lM7ZP5s/7ldvRAmhEypYTPTe/DS9t7LmjLrdfrYif/JeX3UVnLETziesHEVUqUkarmughpRKKep9kkfBIricqKeR9Z6J98zU2jPcVLjDSRzbJFuLWh2TOymSw5yFq8qM2r30NJU6aNtld5Bh/4PUEsHCEpq6ooxBAAAaQ8AAFBLAQIUABQACAgIAKQ4MEpKauqKMQQAAGkPAAAHAAAAAAAAAAAAAAAAAAAAAAB1c2VyLmpzUEsFBgAAAAABAAEANQAAAGYEAAAAAA==}, browserstack.user=jasontownesfrenc1, version=50.0, proxy={}, command_id=1, firefox_binary=c:\Program Files (x86)\firefox 50.0\firefox.exe, browserstack.video=true, orig_os=win8, takesElementScreenshot=true, firefox_profile=UEsDBBQACAAIAJgwMEoAAAAAAAAAA..., proxy_type=node}] Session ID: 67809eeb-fa66-489d-84de-ab8426e6c796

Related

I'm getting this error in selenium after updating chrome

When using Chrome 75 version, I used it well without any error, but after updating to version 76 automatically, I get the following error
[2019-08-10 16:11:52] local.ERROR: sendKeysToActiveElement
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-
14T08:25:53'
System info: host: 'DESKTOP-GLEJ40B', ip: '192.168.0.4', os.name: 'Windows 1
0', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_211'
Driver info: driver.version: unknown {"exception":"[object]
(App\\WebDriver\\Exception\\UnknownCommandException(code: 0):
sendKeysToActiveElement
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-
14T08:25:53'
System info: host: 'DESKTOP-GLEJ40B', ip: '192.168.0.4', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_211'
Driver info: driver.version: unknown at
Driver info: driver.version: unknown at C:\\Bitnami\\wampstack-7.1.30-
I downloaded and replaced the driver from Selenium with version 76 but it's not work
What should i do to make it work the same way?
You can use below code instead of System.setProperty code and add WebDriverManager 3 version jar file in your build path, irrespective of browser version, it will work properly.
WebDriverManager.chromedriver().setup();
DesiredCapabilities dcap = new DesiredCapabilities();
dcap.setCapability("pageLoadStrategy", "none");
ChromeOptions options = new ChromeOptions();
options.merge(dcap);
driver = new ChromeDriver(options);
driver.manage().deleteAllCookies();

Javascript testing a Symfony 3 application with Mink and Selenium

I am trying to test some javascript functionality in my Symfony Application. I tried looking at Mink for this:
http://mink.behat.org/en/latest/.
I ran a composer require for behat/mink, behat/mink-goutte-driver, and behat/mink-selenium2-driver.
I then tried to install Selenium in my ubuntu 16.04 dev enviroment.
I've got a bash script that installs java8, selenium 3.9, openjdk-8-jdk-headless, firefox, xvfb and geckodriver 0.18.0. I seem to start up the selenium server OK.
However, when I then try to start a session with Mink in my tests, I am seeing the following:
Behat\Mink\Exception\DriverException: Could not open connection: Unable to find a matching set of capabilities
Build info: version: '3.9.0', revision: '698b3178f0', time: '2018-02-05T14:56:13.134Z'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.60-linuxkit-aufs', java.version: '1.8.0_161'
Driver info: driver.version: unknown
Caused by
WebDriver\Exception\SessionNotCreated: Unable to find a matching set of capabilities
Build info: version: '3.9.0', revision: '698b3178f0', time: '2018-02-05T14:56:13.134Z'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.60-linuxkit-aufs', java.version: '1.8.0_161'
Driver info: driver.version: unknown
I'm trying to start my session in my test class like this:
// Choose a Mink driver. More about it in later chapters.
$driver = new \Behat\Mink\Driver\Selenium2Driver();
$session = new \Behat\Mink\Session($driver);
// start the session
$session->start();
I assume my problem is to do with the versions of java/firefox/selenium/ geckodriver incompatible with each other? But I can't seem to be able to fix it by trying out other versions... Is anyone able to help?
(This is my first ever question here, so let me know if if isn't great and I will try to improve it!)

The path to the driver executable must be set by the webdriver.chrome.driver system property (php)

I'm having a problems with running my php selenium test. I just switched to Ubuntu os and now i'm getting this exception stack trance on selenium server.
Selenium server
08:58:49.965 INFO - Launching a standalone Selenium Server
08:58:49.986 INFO - Java: Oracle Corporation 25.101-b13
08:58:49.986 INFO - OS: Linux 4.4.0-36-generic amd64
08:58:49.996 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b
08:58:50.040 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
08:58:50.041 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
08:58:50.041 INFO - Driver class not found: com.opera.core.systems.OperaDriver
08:58:50.041 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
08:58:50.041 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
08:58:50.042 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
08:58:50.042 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
08:58:50.075 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
08:58:50.075 INFO - Selenium Server is up and running
08:59:41.556 INFO - Executing: [new session: Capabilities [{browserName=chrome, platform=LINUX}]])
08:59:41.566 INFO - Creating a new session for Capabilities [{browserName=chrome, platform=LINUX}]
08:59:41.573 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'Keson', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-36-generic', java.version: '1.8.0_101'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
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)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'Keson', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-36-generic', java.version: '1.8.0_101'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
... 9 more
Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
... 14 more
08:59:41.576 WARN - Exception: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
Chromdriver is running
Starting ChromeDriver (v2.9.248304) on port 9515
And this is an error when i run the test
There was 1 error:
UnknownServerException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
Why this problem sudenlly appeared? How to fix it? If you need any additional information's please let me know and i will provide.
Thank you in advance
You should set the chrome driver option like this:
java -jar selenium-server-standalone-2.53.0.jar -Dwebdriver.chrome.driver=chromedriver.exe
After the -Dwebdriver.chrome.driver= you should put the path to the cromedriver.

PHPUnit Selenium2 Cannot Find Tag on tests

I'm working on testing a site with PHPUnit (3.7.38), Selenium2 (2.43.1-standalone) and Firefox (34.0), and keep running into an intermittent problem with Selenium not being able to find tags on a page. If I take a screenshot of the error, the tag and content is there and the page looks as if it is fully loaded. There really is no AJAX to speak of on the tags I'm trying to load that would cause issue.
This seems to happen about 50% of the time and in a few specific tests. As well, it seems to gravitate towards specific lines of the test, but usually will change lines if I comment out the offending line. If I wait several minutes between tests it seems to run without error, but other than that I can't find anything that affects it.
The specific exception is:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to locate element: {"method":"tag name","selector":"h2"}
Selenium Trace:
22:32:34.544 INFO - Executing: [find element: By.tagName: h2])
22:32:35.704 WARN - Exception thrown org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"tag name","selector":"h2"}
Command duration or timeout: 220 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'andrew-xubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.7.0_65'
Session ID: e842f08c-176e-4361-859b-8fc8e67b8d5c
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=34.0}]
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:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByTagName(RemoteWebDriver.java:417)
at org.openqa.selenium.By$ByTagName.findElement(By.java:330)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
at com.sun.proxy.$Proxy1.findElement(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:184)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:47)
at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"tag name","selector":"h2"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'andrew-xubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.7.0_65'
Driver info: driver.version: unknown
at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///tmp /anonymous8627931668853884881webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js:9618:26)
at <anonymous class>.FirefoxDriver.prototype.findElement(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js:9627:3)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:11612:16)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:11617:7)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///tmp/anonymous8627931668853884881webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:11559:5)
22:32:35.706 WARN - Exception: Unable to locate element: {"method":"tag name","selector":"h2"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'andrew-xubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.7.0_65'
Driver info: driver.version: unknown`
Looks like upping the time Selenium waits to find elements fixed it. Adding this code to each test increases the time for each time Selenium loads a page.
function setUpPage() {
$this->timeouts ()->implicitWait ( 3000 );
}

ChromeDriver "failed to start" when Selenium started via Jenkins (Mac OS X)

Config: Mac OS X 10.8.5, java 1.6.0_65, Selenium 2.37, Jenkins 1.538, Chrome 30.0.1599.101, ChromeDriver v2.6.232908 and Firefox 25.0.
I'm running tests using PHPUnit 3.7.28 and PHP 5.3.22 (using PHPUnit_Extensions_Selenium2TestCase).
(1) If I manually start Selenium like so:
$ java -jar ~/Downloads/selenium-server-standalone-2.37.0.jar -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver
I can run tests as expected.
(2) However, if I start Selenium via Jenkins:
# launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
And then run my tests, I get an error:
$ phpunit --verbose tests/classes/core/admin_campaignhome_loads.php
PHPUnit 3.7.28 by Sebastian Bergmann.
E
Time: 20.56 seconds, Memory: 5.25Mb
There was 1 error:
1) AdminTest::testLoginToBackend
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: unknown error: Chrome failed to start: exited normally
(Driver info: chromedriver=2.6.232908,platform=Mac OS X 10.8.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'Pauls-iMac.local', ip: '192.168.1.18', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
/usr/local/php5-20130308-201415/lib/php/PHPUnit/TextUI/TestRunner.php:349
/usr/local/php5-20130308-201415/lib/php/PHPUnit/TextUI/Command.php:176
/usr/local/php5-20130308-201415/lib/php/PHPUnit/TextUI/Command.php:129
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
(3) Firefox + Selenium via Jenkins lets me run tests as expected.
jenkins.log has the following:
14:51:11.439 INFO - Executing: [new session: {browserName=chrome}] at URL: /session)
14:51:11.440 INFO - Creating a new session for Capabilities [{browserName=chrome}]
Starting ChromeDriver (v2.6.232908) on port 33014
14:51:31.972 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'Pauls-iMac.local', ip: '192.168.1.18', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:176)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:112)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:89)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:104)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:63)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:205)
at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:192)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
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:914)
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:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'Pauls-iMac.local', ip: '192.168.1.18', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:72)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:56)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:215)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:62)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally
(Driver info: chromedriver=2.6.232908,platform=Mac OS X 10.8.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'Pauls-iMac.local', ip: '192.168.1.18', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:129)
... 14 more
14:51:31.974 WARN - Exception: unknown error: Chrome failed to start: exited normally
(Driver info: chromedriver=2.6.232908,platform=Mac OS X 10.8.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'Pauls-iMac.local', ip: '192.168.1.18', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Its because the jenkins started instance doesn't have the chrome capability
Look at
http://localhost:4444
to see the capabilities it has
You can add additional capabilities in with
java -jar selenium-server-standalone-2.37.0.jar -role node \
-hub http://localhost:4444/grid/register \
-browser "browserName=chrome,version=25,maxInstances=5" \
-Dwebdriver.chrome.driver="/usr/local/bin/chromedriver" \
-host localhost \
-port 5556
You can use different -port settings to spin up several capabilites from the same machine or even connect in from different machines by changing the -hub to the real address of the selenium server
EDIT
I recreated your problem with connecting my chrome driver without the
-Dwebdriver.chrome.driver='...'
I'm on v2.33.0
13:18:44.922 WARN - Exception thrown
java.util.concurrent.ExecutionException:
org.openqa.selenium.WebDriverException:
java.lang.reflect.InvocationTargetException Build info: version:
'2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38' System
info: os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.0-55-generic', java.version: '1.7.0_45' Driver info:
driver.version: unknown at
java.util.concurrent.FutureTask.report(FutureTask.java:122) at
java.util.concurrent.FutureTask.get(FutureTask.java:188) at
org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:176)
So I suspect the Selenium-jenkins plugin you're using has no chromedriver set or it has an invalid one.
There is a log to check (I don't have the selenium grid on my Jenkins anymore) or possibly add the path to the chromedriver to your path as in this thread https://groups.google.com/forum/?fromgroups#!topic/selenium-users/-3LJ3wma3RE

Categories