Javascript testing a Symfony 3 application with Mink and Selenium - php

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

Related

Run tests using Behat and Mink Selenium2 driver for Microsoft Edge browser in Selenium 4

Is it possible to run tests on Edge browser using Mink Selenium2 driver and Selenium 4 grid ?
I've tried using:
default:
suites:
default:
filters:
tags: ~#wip
paths: ['%paths.base%/storage/features']
gherkin:
cache: ~
extensions:
Behat\MinkExtension:
base_url: http://www.google.com
javascript_session: selenium2
browser_name: edge
selenium2:
capabilities:
browserName: MicrosoftEdge
browser: edge
extra_capabilities:
edgeOptions:
args:
- "--no-sandbox"
- "--disable-dev-shm-usage"
- "--headless"
- "--disable-gpu"
- "--dns-prefetch-disable"
- "--disable-setuid-sandbox"
- "--window-size=1920,1080"
- "--remote-debugging-port=9222"
But this gives me some errors saying that the DevToolsActivePort file does not exist:
13:38:41.079 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
13:38:41.086 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
13:38:41.942 INFO [NodeOptions.getSessionFactories] - Detected 8 available processors
13:38:41.970 INFO [NodeOptions.discoverDrivers] - Discovered 3 driver(s)
13:38:41.997 INFO [NodeOptions.report] - Adding Edge for {"browserName": "MicrosoftEdge"} 8 times
13:38:41.999 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome"} 8 times
13:38:42.000 INFO [NodeOptions.report] - Adding Firefox for {"browserName": "firefox"} 8 times
13:38:42.039 INFO [Node.<init>] - Binding additional locator mechanisms: id, relative, name
13:38:42.067 INFO [LocalDistributor.add] - Added node fb3c75f0-847d-475d-88b0-dea6893c09c2 at http://172.19.0.7:4444. Health check every 120s
13:38:42.068 INFO [GridModel.setAvailability] - Switching node fb3c75f0-847d-475d-88b0-dea6893c09c2 (uri: http://172.19.0.7:4444) from DOWN to UP
13:38:42.251 INFO [Standalone.execute] - Started Selenium Standalone 4.0.0 (revision 3a21814679): http://172.19.0.7:4444
Starting MSEdgeDriver 95.0.1020.30 (09f7018e2a65a55dea3a0a261efca40ae03471ed) on port 36979
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe.
MSEdgeDriver was started successfully.
[1634828868.563][SEVERE]: bind() failed: Cannot assign requested address (99)
15:07:48.749 WARN [SeleniumSpanExporter$1.lambda$export$0] - {"traceId": "49c55d39b0c26898585047f89ad32f33","eventTime": 1634828868685689900,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:36979","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: MSEdge failed to start: exited abnormally.\n (unknown error: DevToolsActivePort file doesn't exist)\n (The process started from msedge location \u002fusr\u002fbin\u002fmicrosoft-edge is no longer running, so MSEdgeDriver is assuming that MSEdge has crashed.)\nBuild info: version: '4.0.0', revision: '3a21814679'\nSystem info: host: 'dee4c77efe99', ip: '172.19.0.7', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.25-linuxkit', java.version: '11.0.11'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: MSEdge failed to start: exited abnormally.\n (unknown error: DevToolsActivePort file doesn't exist)\n (The process started from msedge location \u002fusr\u002fbin\u002fmicrosoft-edge is no longer running, so MSEdgeDriver is assuming that MSEdge has crashed.)\nBuild info: version: '4.0.0', revision: '3a21814679'\nSystem info: host: 'dee4c77efe99', ip: '172.19.0.7', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.25-linuxkit', java.version: '11.0.11'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:131)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:65)\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:143)\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:315)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:513)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:440)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:648)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:612)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:829)\n","exception.type": "org.openqa.selenium.SessionNotCreatedException","logger": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory","session.capabilities": "{\"browserName\": \"MicrosoftEdge\"}\n"}}```
is there any way to make this work ?
Please make sure you have
127.0.0.1 localhost
in your /etc/hosts file.
To check it, you should go to the terminal and run
sudo vi /etc/hosts
type your user password and paste
127.0.0.1 localhost
to an empty row.
Additionally, please make sure you have ChromeDriver -or the driver of the browser you intend to use- is installed and your program knows the path of ChromeDriver.
You can follow the steps explained here https://www.browserstack.com/guide/run-selenium-tests-using-selenium-chromedriver.
For DevToolsActivePort error try another workaround: add --remote-debugging-port=
I tried a different version of Selenium server with Edge, including version 4, till version 3.5; it is working fine, and above, it gives different errors. I can see that Selenium 4 is in alpha release at the Maven repository, and all other versions were released in October 2021. I would recommend that you use an earlier version for some time. You can refer to this article for the configuration of Edge with Behat Mink Selenium 2.

Selenium PHP Web Driver (Facebook) issue

I have a problem with web driver startup for selenium on Ubuntu 14.04.
I've already installed Oracle JDK and Selenium Standalone Server, also have no issue with running Selenium Standalone Server on Ubuntu 14.04 (I use cloud9 VDS).
But when I try to run this example an error occurs (Unable to create new service):
Fatal error: Uncaught exception 'Facebook\WebDriver\Exception\SessionNotCreatedException' with message ' in /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 154 Facebook\WebDriver\Exception\SessionNotCreatedException: Unable to create new service: ChromeDriverService Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z' System info: host: 'user-selenium-6138185', ip: '173.18.0.42', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.80-c9', java.version: '1.8.0_171' Driver info: driver.version: unknown in /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 154 Call Stack: 0.0005 234144 1. {main}() /home/ubuntu/workspace/php-web-driver-test/test-1.php:0 0.0020 307072 2. Facebook\WebDriver\Remote\RemoteWebDriver::create() /home/ubuntu/workspace/php-web-driver-test/test-1.php:11 0.0030 387224 3. Facebook\WebDriver\Remote\HttpCommandExecutor->execute() /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126 0.1971 486960 4. Facebook\WebDriver\Exception\WebDriverException::throwException() /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:320
Also there is some response from Selenium Server:
06:04:33.192 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
06:04:33.194 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-05-16 06:04:33.330:INFO::main: Logging initialized #566ms to org.seleniumhq.jetty9.util.log.StdErrLog
06:04:33.641 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
06:04:42.085 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: chrome}
06:04:42.088 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
I don't know why such an error occurs, may be I have to force browser headless mode option or specify exact firefox or chrome location for web driver?

moveMouse() selenium gives error

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

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 and Selenium and getting value from elements issue

So I'm starting out with PHPUnit and Selenium 2
public function testHasALoginForm()
{
$this->url('/login');
$username = $this->byName('username');
$password = $this->byName('password');
$this->assertEquals('', $username->value());
$this->assertEquals('', $password->value());
}
This only happens when I call the value() method from the element and I end up getting:
1) test\view\LoginTest::testHasALoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: GET /session/fdcf0669-1d42-4a35-8e7a-29dec4a0f1e4/element/0/value
Build info: version: '2.42.1', revision: '68b415a', time: '2014-05-29 16:16:49'
System info: host: 'Something.local', ip: '192.168.1.108', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.3', java.version: '1.8.0_05'
Driver info: driver.version: unknown
Am I doing something wrong?
The ->value() method has been removed in selenium v2.42.0. The currently recommended solution is to use $element->attribute('value')
#see https://code.google.com/p/selenium/source/detail?r=953007b48e83f90450f3e41b11ec31e2928f1605
Hi i'm getting exactly the same error with roughly the same code. I am using the same version of selenium as you are.
However I did not get this error when using the 2.39.0 version.
Hence it seems to be either a regression or a deprecated use.

Categories