lmc-eu / steward

PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust
MIT License
221 stars 40 forks source link

Chrome tests wont' work #159

Closed dking3876 closed 6 years ago

dking3876 commented 7 years ago

i am unable to get any test to perform on chrome. using firefox everything works fine. when switching to use chrome it does not

<?php namespace My; // Note the "My" namespace maps to the "tests" folder, as defined in the autoload part ofcomposer.json`.

use Facebook\WebDriver\WebDriverBy; use Facebook\WebDriver\WebDriverExpectedCondition; use Lmc\Steward\Test\AbstractTestCase;

class TitlePageTest extends AbstractTestCase { protected $url = "http://design.brafton.com/escoffier/"; public function testDoesNotHaveWordpressInTitle() { // Load the URL (will wait until page is loaded) $this->wd->get($this->url); // $this->wd holds instance of \RemoteWebDriver

    // Do some assertion
    // $this->assertContains('W3C', $this->wd->getTitle());

    // You can use $this->log(), $this->warn() or $this->debug() with sprintf-like syntax
    $this->log('Current page "%s" has title "%s"', $this->wd->getCurrentURL(), $this->wd->getTitle());

    // // Make sure search input is present
    // $searchInput = $this->wd->findElement(WebDriverBy::cssSelector('#search-form input'));
    // Or you can use syntax sugar provided by Steward (this is equivalent of previous line)
    // $searchInput = $this->findByCss('#search-form input');

    // Assert title of the search input
    $this->assertNotContains($this->wd->getTitle(), ['wordpress', 'WordPress', 'Wordpress']);
}
public function testSearchForDog(){
    $this->wd->get($this->url);

    $input = $this->wd->findElement(WebDriverBy::cssSelector('input[name=s]'))->sendKeys("Dog");

    $this->wd->findElement(WebDriverBy::id('searchsubmit'))->click();
    $body = $this->wd->wait(10)->until(
        WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(
            WebDriverBy::className('search-results')
        )
    );
    var_dump($body);
    $this->assertEquals('body',$body[0]->getTagName());
}

}`

OndraM commented 7 years ago

Hi @dking3876 , could you please provide more verbose information? Eg. the whole Steward output (including the error you face), the command you use to run steward tests, Steward and Chromedriver version etc.? Thanks :)

drupalmk commented 6 years ago

Hi @OndraM

Maybe I will add my two cent to this ticket. I really would like to have chrome with selenium on board.

I'm working in vagrant environment locally, CI is executed on Teamcity server. I'm trying to replace Behat with Steward as testing framework.

OS: centos-release-7-1.1503.el7.centos.2.8.x86_64 Selenium: 3.11 Chrome: 65.0.3325.162 ChromeDriver: 2.36.540471

Running selenium: java -Dwebdriver.chrome.driver="/var/www/myproj/steward/chromedriver" -jar ./vendor/bin/selenium-server-standalone-3.11.0.jar -port 8666

Running tests: ./vendor/bin/steward run staging chrome -vvv --server-url http://localhost:8666

Output:

PHP Fatal error: Uncaught exception 'Facebook\WebDriver\Exception\UnknownServerException' with message 'unknown error: Chrome failed to start: exited abnormally Buchi\TitlePageTest ERR> (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Buchi\TitlePageTest ERR> Command duration or timeout: 60.08 seconds Buchi\TitlePageTest ERR> Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z' Buchi\TitlePageTest ERR> System info: host: 'vagrant.unic.com', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121' Buchi\TitlePageTest ERR> Driver info: driver.version: unknown'

Could you give me any suggestions? thanks in advance.

OndraM commented 6 years ago

@drupalmk Hi, and do you have some graphical interface inside the vagrant box?

Selenium needs to open browser window (if you don't use headless chrome). So if you have shell-only vagrant, it may be the cause.

Also you can pass -debug to the java command, so that selenium provide more verbose output.

drupalmk commented 6 years ago

Nope, not ui support at all, can i pass --headless parameter to chrome? An output with -debug is the same.

OndraM commented 6 years ago

And what is the output of the selenium server?

Also I would not recommend running chrome inside vagrant, but either use it locally or via Docker - see howto in our wiki.

drupalmk commented 6 years ago

Whome Selenium output:

java -debug -Dwebdriver.chrome.driver="/var/www/buchi/steward/chromedriver" -jar ./vendor/bin/selenium-server-standalone-3.11.0.jar -port 8666 15:35:46.788 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.11.0', revision: 'e59cfb3' 15:35:46.789 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 8666 2018-03-16 15:35:46.900:INFO::main: Logging initialized @475ms to org.seleniumhq.jetty9.util.log.StdErrLog 15:35:47.120 INFO [SeleniumServer.boot] - Welcome to Selenium for Workgroups.... 15:35:47.120 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 8666 15:35:52.072 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: chrome, name: Buchi\TitlePageTest::testSh..., requiredCapabilities: []} 15:35:52.073 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) Starting ChromeDriver 2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752) on port 2693 Only local connections are allowed. 15:45:36.714 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: chrome, name: Buchi\TitlePageTest::testSh..., requiredCapabilities: []} 15:45:36.714 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) Starting ChromeDriver 2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752) on port 18265 Only local connections are allowed.

Do you suggests using Firefox driver for no ui environments?

OndraM commented 6 years ago

No, Chrome is pretty fine and currently more reliable.

Could you please try some older version of Selenium server? Like 3.8.1?

If it won't help, try starting selenium with -enablePassThrough false param like this java -jar vendor/bin/selenium-server-standalone-3.8.1.jar -enablePassThrough false -debug (note the param could be only used with Selenium <=3.8.1)

drupalmk commented 6 years ago

Thanks for the suggestion. This is my output:

java -debug -Dwebdriver.chrome.driver="/var/www/buchi/steward/chromedriver" -jar ./vendor/bin/selenium-server-standalone-3.11.0.jar -port 8666 -enablePassThrough false Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-enablePassThrough' but no main parameter was defined in your arg class at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:936) at com.beust.jcommander.JCommander.parseValues(JCommander.java:752) at com.beust.jcommander.JCommander.parse(JCommander.java:340) at com.beust.jcommander.JCommander.parse(JCommander.java:319) at org.openqa.grid.internal.cli.StandaloneCliOptions.parse(StandaloneCliOptions.java:28) at org.openqa.grid.selenium.GridLauncherV3$1.(GridLauncherV3.java:256) at org.openqa.grid.selenium.GridLauncherV3.lambda$buildLaunchers$0(GridLauncherV3.java:255) at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:163) at org.openqa.grid.selenium.GridLauncherV3.launch(GridLauncherV3.java:97) at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:81)

Do you have an idea?

OndraM commented 6 years ago

As I wrote, you need Selenium <= 3.8.1 for this param ;-).

But try the 3.8.1 version without the param first.

Dne pá 16. bře 2018 16:18 uživatel drupalmk notifications@github.com napsal:

Thanks for the suggestion. This is my output:

java -debug -Dwebdriver.chrome.driver="/var/www/buchi/steward/chromedriver" -jar ./vendor/bin/selenium-server-standalone-3.11.0.jar -port 8666 -enablePassThrough false Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-enablePassThrough' but no main parameter was defined in your arg class at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:936) at com.beust.jcommander.JCommander.parseValues(JCommander.java:752) at com.beust.jcommander.JCommander.parse(JCommander.java:340) at com.beust.jcommander.JCommander.parse(JCommander.java:319) at org.openqa.grid.internal.cli.StandaloneCliOptions.parse(StandaloneCliOptions.java:28) at org.openqa.grid.selenium.GridLauncherV3$1.(GridLauncherV3.java:256) at org.openqa.grid.selenium.GridLauncherV3.lambda$buildLaunchers$0(GridLauncherV3.java:255) at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:163) at org.openqa.grid.selenium.GridLauncherV3.launch(GridLauncherV3.java:97) at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:81)

Do you have an idea?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lmc-eu/steward/issues/159#issuecomment-373745905, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwZ0WjeVApXhSwl4bys1Zfvihw4wM5hks5te9e-gaJpZM4PmcOU .

drupalmk commented 6 years ago

Same error message :( with or without parameter:

java -debug -Dwebdriver.chrome.driver="/var/www/buchi/steward/chromedriver" -jar ./vendor/bin/selenium-server-standalone-3.8.1.jar -port 8666 -enablePassThrough false -debug

> 16:40:18.762 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
> 16:40:18.763 INFO - Launching a standalone Selenium Server
> 2018-03-16 16:40:18.852:INFO::main: Logging initialized @321ms to org.seleniumhq.jetty9.util.log.StdErrLog
> 16:40:18.904 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
> 16:40:18.928 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
> 16:40:18.930 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
> 16:40:18.930 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 16:40:18.930 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
> 16:40:18.931 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
> 16:40:18.932 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
> 16:40:18.967 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
>  registration capabilities Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: } does not match the current platform LINUX
> 16:40:18.979 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
>  registration capabilities Capabilities {browserName: MicrosoftEdge, platform: WINDOWS, version: } does not match the current platform LINUX
> 16:40:18.980 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
>  registration capabilities Capabilities {browserName: safari, platform: MAC, version: } does not match the current platform LINUX
> 16:40:19.014 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
> 16:40:19.015 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
> 16:40:19.015 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
> 16:40:19.015 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
> 16:40:19.015 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
> 2018-03-16 16:40:19.050:INFO:osjs.Server:main: jetty-9.4.7.v20170914
> 2018-03-16 16:40:19.077:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@6950e31{/,null,STARTING} has uncovered http methods for path: /
> 2018-03-16 16:40:19.080:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@6950e31{/,null,AVAILABLE}
> 2018-03-16 16:40:19.097:INFO:osjs.AbstractConnector:main: Started ServerConnector@5c072e3f{HTTP/1.1,[http/1.1]}{0.0.0.0:8666}
> 2018-03-16 16:40:19.097:INFO:osjs.Server:main: Started @566ms
> 16:40:19.097 INFO - Selenium Server is up and running
> 16:40:24.622 DEBUG - Handling: GET /status
> 16:40:24.627 DEBUG - Executing: org.openqa.selenium.remote.server.handler.Status@18a1798a)
> 16:40:24.630 DEBUG - Done: org.openqa.selenium.remote.server.handler.Status@18a1798a
> 16:40:24.630 DEBUG - Finished: GET /status
> 16:40:24.738 DEBUG - Handling: GET /status
> 16:40:24.739 DEBUG - Executing: org.openqa.selenium.remote.server.handler.Status@78752d9e)
> 16:40:24.739 DEBUG - Done: org.openqa.selenium.remote.server.handler.Status@78752d9e
> 16:40:24.739 DEBUG - Finished: GET /status
> 16:40:24.930 DEBUG - Handling: POST /session
> 16:40:24.937 INFO - Executing: [new session: Capabilities {browserName: chrome, name: Buchi\TitlePageTest::testSh..., platform: ANY, requiredCapabilities: []}])
> 16:40:24.961 INFO - Creating a new session for Capabilities {browserName: chrome, name: Buchi\TitlePageTest::testSh..., platform: ANY, requiredCapabilities: []}
> 16:40:25.313 DEBUG - Executing: newSession [null, newSession {desiredCapabilities=Capabilities {browserName: chrome, name: Buchi\TitlePageTest::testSh..., platform: ANY, requiredCapabilities: []}}]
> 16:40:25.325 DEBUG - Waiting for [http://localhost:10521/status]
> 16:40:25.332 DEBUG - Polling http://localhost:10521/status
> Starting ChromeDriver 2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752) on port 10521
> Only local connections are allowed.
> 16:40:25.348 DEBUG - Polling http://localhost:10521/status
> 16:40:25.349 DEBUG - sun.net.www.MessageHeader@6d26e5035 pairs: {GET /status HTTP/1.1: null}{User-Agent: Java/1.8.0_121}{Host: localhost:10521}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
> 16:40:25.352 DEBUG - sun.net.www.MessageHeader@282466c33 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 141}{Content-Type: application/json; charset=utf-8}
> 16:40:25.471 DEBUG - CookieSpec selected: default
> 16:40:25.477 DEBUG - Auth cache not set in the context
> 16:40:25.478 DEBUG - Connection request: [route: {}->http://localhost:10521][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
> 16:40:25.486 DEBUG - Connection leased: [id: 0][route: {}->http://localhost:10521][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
> 16:40:25.488 DEBUG - Opening connection {}->http://localhost:10521
> 16:40:25.488 DEBUG - Connecting to localhost/127.0.0.1:10521
> 16:40:25.489 DEBUG - Connection established 127.0.0.1:39330<->127.0.0.1:10521
> 16:40:25.489 DEBUG - http-outgoing-0: set socket timeout to 10800000
> 16:40:25.489 DEBUG - Executing request POST /session HTTP/1.1
> 16:40:25.489 DEBUG - Target auth state: UNCHALLENGED
> 16:40:25.489 DEBUG - Proxy auth state: UNCHALLENGED
> 16:40:25.492 DEBUG - http-outgoing-0 >> POST /session HTTP/1.1
> 16:40:25.492 DEBUG - http-outgoing-0 >> Content-Type: application/json; charset=utf-8
> 16:40:25.492 DEBUG - http-outgoing-0 >> Content-Length: 394
> 16:40:25.492 DEBUG - http-outgoing-0 >> Host: localhost:10521
> 16:40:25.492 DEBUG - http-outgoing-0 >> Connection: Keep-Alive
> 16:40:25.493 DEBUG - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121)
> 16:40:25.493 DEBUG - http-outgoing-0 >> Accept-Encoding: gzip,deflate
> 16:40:25.493 DEBUG - http-outgoing-0 >> "POST /session HTTP/1.1[\r][\n]"
> 16:40:25.493 DEBUG - http-outgoing-0 >> "Content-Type: application/json; charset=utf-8[\r][\n]"
> 16:40:25.493 DEBUG - http-outgoing-0 >> "Content-Length: 394[\r][\n]"
> 16:40:25.493 DEBUG - http-outgoing-0 >> "Host: localhost:10521[\r][\n]"
> 16:40:25.493 DEBUG - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
> 16:40:25.493 DEBUG - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121)[\r][\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "[\r][\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "{[\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "  "desiredCapabilities": {"browserName":"chrome","name":"Buchi\\TitlePageTest::testShouldContainSearchInput","platform":"ANY","requiredCapabilities":[]},[\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "  "capabilities": {[\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "    "desiredCapabilities": {"browserName":"chrome","name":"Buchi\\TitlePageTest::testShouldContainSearchInput","platform":"ANY","requiredCapabilities":[]},[\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "    "firstMatch": [[\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "      {"browserName":"chrome"}[\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "    ][\n]"
> 16:40:25.494 DEBUG - http-outgoing-0 >> "  }[\n]"
> 16:40:25.499 DEBUG - http-outgoing-0 >> "}"
> 16:41:25.557 DEBUG - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
> 16:41:25.557 DEBUG - http-outgoing-0 << "Content-Length:273[\r][\n]"
> 16:41:25.557 DEBUG - http-outgoing-0 << "Content-Type:application/json; charset=utf-8[\r][\n]"
> 16:41:25.557 DEBUG - http-outgoing-0 << "[\r][\n]"
> 16:41:25.557 DEBUG - http-outgoing-0 << "{"sessionId":"6aa3f4ccee232741e2bae0557344fd2e","status":13,"value":{"message":"unknown error: Chrome failed to start: exited abnormally\n  (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64)"}}"
> 16:41:25.560 DEBUG - http-outgoing-0 << HTTP/1.1 200 OK
> 16:41:25.560 DEBUG - http-outgoing-0 << Content-Length:273
> 16:41:25.560 DEBUG - http-outgoing-0 << Content-Type:application/json; charset=utf-8
> 16:41:25.562 DEBUG - Connection can be kept alive indefinitely
> 16:41:25.563 DEBUG - Connection [id: 0][route: {}->http://localhost:10521] can be kept alive indefinitely
> 16:41:25.564 DEBUG - Connection released: [id: 0][route: {}->http://localhost:10521][total kept alive: 1; route allocated: 1 of 2000; total allocated: 1 of 2000]
> 16:41:25.580 WARN - Exception thrown
> org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
> Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
> System info: host: 'vagrant.unic.com', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121'
> Driver info: driver.version: unknown
>   at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:116)
>   at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:102)
>   at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:87)
>   at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:171)
>   at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:88)
>   at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:76)
>   at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:72)
>   at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:63)
>   at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:37)
>   at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
>   at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:191)
>   at org.openqa.selenium.remote.server.DriverServlet.lambda$handleRequest$0(DriverServlet.java:261)
>   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   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:108)
>   ... 16 more
> Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
>   (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
> Command duration or timeout: 60.12 seconds
> Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
> System info: host: 'vagrant.unic.com', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121'
> Driver info: driver.version: ChromeDriver
>   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.ErrorHandler.createThrowable(ErrorHandler.java:214)
>   at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
>   at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
>   at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
>   at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
>   at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
>   at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
>   at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
>   at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
>   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
>   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
>   at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
>   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>   at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
>   at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
>   at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
>   at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
>   at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
>   at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
>   at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
>   at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
>   at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
>   at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:147)
>   ... 21 more
> 16:41:25.582 WARN - Exception: unknown error: Chrome failed to start: exited abnormally
>   (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
> Command duration or timeout: 60.12 seconds
> Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
> System info: host: 'vagrant.unic.com', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121'
> Driver info: driver.version: ChromeDriver
> 16:41:25.616 DEBUG - Finished: POST /session
`

`./vendor/bin/steward run staging chrome -vvv --server-url http://localhost:8666`

> Steward 2.3.3 is running the tests... Just for you <3!
> Browser: chrome
> Environment: staging
> Base path to fixtures results: /var/www/buchi/steward/tests
> Path to logs: /var/www/buchi/steward/logs
> Ignore delays: no
> Selenium server (hub) url: http://localhost:8666, trying connection...OK
> Searching for testcases:
>  - in directory "/var/www/buchi/steward/tests"
>  - by pattern "*Test.php"
> Found testcase file #1: /var/www/buchi/steward/tests/TitlePageTest.php
> Testcase "Buchi\TitlePageTest" is prepared to be run
> 
> Starting execution of testcases
> -------------------------------
> [2018-03-16 16:40:24] Execution of testcase "Buchi\TitlePageTest" started with command:
> '/usr/bin/php' '/var/www/buchi/steward/vendor/lmc/steward/bin/phpunit-steward' '--log-junit=/var/www/buchi/steward/logs/Buchi-TitlePageTest.xml' '--configuration=/var/www/buchi/steward/vendor/lmc/steward/src/phpunit.xml' '--colors=always' '/var/www/buchi/steward/tests/TitlePageTest.php'
> [2018-03-16 16:40:24] Waiting (running: 1, queued: 0, done: 0)
> Buchi\TitlePageTest> [2018-03-16 16:40:24]: Registering test results publisher "Lmc\Steward\Publisher\XmlPublisher"
> Buchi\TitlePageTest> PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
> Buchi\TitlePageTest>
> Buchi\TitlePageTest> [2018-03-16 16:40:24]: Initializing "chrome" WebDriver for "Buchi\TitlePageTest::testShouldContainSearchInput"
> Buchi\TitlePageTest>
> [2018-03-16 16:40:34] Waiting (running: 1, queued: 0, done: 0)
> [2018-03-16 16:40:44] Waiting (running: 1, queued: 0, done: 0)
> [2018-03-16 16:40:55] Waiting (running: 1, queued: 0, done: 0)
> [2018-03-16 16:41:05] Waiting (running: 1, queued: 0, done: 0)
> [2018-03-16 16:41:15] Waiting (running: 1, queued: 0, done: 0)
> [2018-03-16 16:41:25] Waiting (running: 1, queued: 0, done: 0)
> Buchi\TitlePageTest ERR> PHP Fatal error:  Uncaught exception 'Facebook\WebDriver\Exception\UnknownServerException' with message 'unknown error: Chrome failed to start: exited abnormally
> Buchi\TitlePageTest ERR>   (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
> Buchi\TitlePageTest ERR> Command duration or timeout: 60.12 seconds
> Buchi\TitlePageTest ERR> Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
> Buchi\TitlePageTest ERR> System info: host: 'vagrant.unic.com', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121'
> Buchi\TitlePageTest ERR> Driver info: driver.version: ChromeDriver' in /var/www/buchi/steward/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:114
> Buchi\TitlePageTest ERR> Stack trace:
> Buchi\TitlePageTest ERR> #0 /var/www/buchi/steward/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php(320): Facebook\WebDriver\Exception\WebDriverException::throwException(13, 'unknown error: ...', Array)
> Buchi\TitlePageTest ERR> #1 /var/www/buchi/steward/vendor/facebook/webdriver/li in /var/www/buchi/steward/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 114
> [2018-03-16 16:41:25] Finished execution of testcase "Buchi\TitlePageTest" (result: fatal, time: 61.0 sec)
> [2018-03-16 16:41:25] Waiting (running: 0, queued: 0, done: 1 [fatal: 1])
> [2018-03-16 16:41:25] All testcases done in 61.4 seconds
> 
> 
>  [ERROR] Testcases executed: 1 (fatal: 1)
drupalmk commented 6 years ago

Hi @OndraM

Thanks for support. I was experimenting with different versions of driver and browser itself, but without progress. Same error.

Had tried: https://gist.github.com/addyosmani/5336747 but seems i'm using it wrong or just this also don't work. I'll try Docker now.

Cheers!

OndraM commented 6 years ago

@drupalmk Hi, it seems your Chrome have problem starting up. It looks like it may be missing DISPLAY environment variable as suggested here: https://stackoverflow.com/questions/22558077/unknown-error-chrome-failed-to-start-exited-abnormally-driver-info-chromedri

Another option is you are affected by this bug: https://github.com/SeleniumHQ/selenium/issues/4961 You can try adding this --no-sandbox option of CustomCapabilitiesResolver, as I've done in steward-example repository: https://github.com/OndraM/steward-example/commit/db87d0e71c36b8406dbdbe728bfd238f9e8066a3