Ramesh,

I am a bit irritated. Your subject line says PhantomJS, the message body says GeckoDriver (i.e. Firefox). So which one causes the problem?

Please also note that for PhantomJS you do not need a framebuffer (xvfb), which is the main reason for me using it with Jenkins and my recommendation for you, too. I have no experience with drivers needing normal browsers on headless CI servers and using xvfb, so I also do not know how well that works. When I need to run normal browsers in a "headless" mode, usually I use cloud testing services, e.g. Testbirds, Browserstack etc.

Having read your SO post, I see that the problem seems to be caused by GeckoDriver and in the stacktrace there also is a C/C++ stacktrace, which IMO should not happen. So maybe there really is an intermittent problem with the driver or with same plus xvfb, I have no idea. I strongly doubt that Geb is connected to the problem in any way, so maybe here is not the right place to ask.

Kind regards
--
Alexander Kriegisch
https://scrum-master.de
 
Ramesh schrieb am 04.02.2019 21:53:
hi Marcin,
Most of the time, the test runs fine but randomly sometimes I get this  DriverCreationException because of connection refused. 
Please see stacktrace below. All my dependencies have no problem.

Different combinations that I tried were:

1) Selenium 3.12.0 geb-spock:2.1 GeckoDriver 0.18.0

2) Selenium 3.12.0 geb-spock:2.1 GeckoDriver 0.23.0

3) Selenium 3.14.0 geb-spock:2.1 GeckoDriver 0.23.0

I even tried setting xvfb display to an offset of 5. Also, checked any defunt geckodriver and firefox. There were no such defunct processes.

Is there a way to try and catch this "org.openqa.selenium.WebDriverException: connection refused" and then try to create driver again? I asked the same question in stack overflow forum here: https://stackoverflow.com/questions/54463201/org-openqa-selenium-webdriverexception-connection-refused-with-selenium-geb-gec

 
geb.driver.DriverCreationException: failed to create driver from callback 'script1548780037482534636672$_run_closure1$_closure4$_closure7@288e23a'
    at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
    at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
    at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
    at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
    at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
    at geb.Configuration.createDriver(Configuration.groovy:382)
    at geb.Configuration.getDriver(Configuration.groovy:371)
    at geb.Browser.getDriver(Browser.groovy:111)
    at geb.navigator.factory.BrowserBackedNavigatorFactory.<init>(BrowserBackedNavigatorFactory.groovy:35)
    at geb.Configuration.createNavigatorFactory(Configuration.groovy:417)
    at geb.Browser.createNavigatorFactory(Browser.groovy:133)
    at geb.Browser.getNavigatorFactory(Browser.groovy:121)
    at geb.Page.init(Page.groovy:144)
    at geb.Browser.createPage(Browser.groovy:859)
    at geb.Browser.to(Browser.groovy:550)
    at geb.Browser.to(Browser.groovy:539)
    at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56)
    at tests.UserTest.Step 1: user can login(UserTest.groovy:40)
Caused by: org.openqa.selenium.WebDriverException: connection refused

 

Thanks,
Ramesh
 
On Monday, May 22, 2017 at 6:16:25 AM UTC-4, Marcin Erdmann wrote:
The exception is thrown from within phantom js driver (at org.openqa.selenium.phantomjs.PhantomJSDriverService.findPhantomJS) and suggests to me that you are using a selenium version which is incompatible with that version of the driver. Removing the `transitive = false` from your dependency declaration should pull in the right version.
 
On Mon, May 22, 2017 at 10:35 AM, <[email protected]> wrote:
I am on win8.1 using phantomjs-2.1.1-windows.


On Monday, May 22, 2017 at 11:32:38 AM UTC+2, [email protected] wrote:
I tried with 
 
gebVersion = '1.1.1'
 
testCompile("com.codeborne:phantomjsdriver:1.4.2") {
    // phantomjs driver pulls in a different selenium version
    transitive = false
}
 
and got following
 
    geb.driver.DriverCreationException: failed to create driver from callback 'script1495445430407551713159$_run_closure2$_closure24$_closure46@6b4fae3c'
 
        Caused by:
        java.lang.IllegalAccessError: tried to access class org.openqa.selenium.os.ExecutableFinder from class org.openqa.selenium.phantomjs.PhantomJSDriverService
 
    geb.driver.DriverCreationException: failed to create driver from callback 'script1495445430407551713159$_run_closure2$_closure24$_closure46@6b4fae3c'
 
        Caused by:
        java.lang.IllegalAccessError: org/openqa/selenium/os/ExecutableFinder
 
com.bechtle.test.functional.specifications.next.hardware.shared.login.Login_TestSpec > Test: Go to CustomerAccountLoginPage FAILED
    geb.driver.DriverCreationException: failed to create driver from callback 'script1495445430407551713159$_run_closure2$_closure24$_closure46@6b4fae3c'
        at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
        at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
        at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
        at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
        at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
        at geb.Configuration.createDriver(Configuration.groovy:382)
        at geb.Configuration.getDriver(Configuration.groovy:371)
        at geb.Browser.getDriver(Browser.groovy:111)
        at geb.report.PageSourceReporter.getPageSource(PageSourceReporter.groovy:42)
        at geb.report.PageSourceReporter.writePageSource(PageSourceReporter.groovy:38)
        at geb.report.PageSourceReporter.writeReport(PageSourceReporter.groovy:29)
        at geb.report.CompositeReporter.writeReport(CompositeReporter.groovy:31)
        at geb.Browser.report(Browser.groovy:927)
        at geb.spock.GebReportingSpec.report(GebReportingSpec.groovy:59)
        at com.bechtle.test.functional.specifications.next.hardware.shared.login.Login_TestSpec.Test: Go to CustomerAccountLoginPage(Login_TestSpec.groovy:20)
 
        Caused by:
        java.lang.IllegalAccessError: org/openqa/selenium/os/ExecutableFinder
            at org.openqa.selenium.phantomjs.PhantomJSDriverService.findPhantomJS(PhantomJSDriverService.java:232)
            at org.openqa.selenium.phantomjs.PhantomJSDriverService.createDefaultService(PhantomJSDriverService.java:181)
            at script1495445430407551713159$_run_closure2.closure24$_closure46(script1495445430407551713159.groovy:497)
            at script1495445430407551713159$_run_closure2.closure24$_closure46(script1495445430407551713159.groovy)
            at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
            ... 14 more
 
 

On Monday, May 22, 2017 at 11:08:22 AM UTC+2, Marcin Erdmann wrote:
I don't see why it would not work with 1.4.x. What's the error you're getting?
 
On Mon, May 22, 2017 at 8:52 AM, <[email protected]> wrote:
hi,
should geb 1.x work with com.codeborne:phantomjsdriver:1.4.x? I can only get it work with com.codeborne:phantomjsdriver:1.3.0.
any idea, hint or experience?
thank you
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/f0f771f3-9101-4d62-942d-e1f907d0aa63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/d98c6fde-7a12-4db6-9c34-5457acd4c8d3%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/4eb068c9-4aa9-4275-8b36-ff3cd0da7761%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/20190205023344.9474444C4F2A%40dd39516.kasserver.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to