1

I get this exception when I want to run my selenium tests in intellij:

geb.driver.DriverCreationException: failed to create driver from callback 'script14601033971711755627056$_run_closure5@2eb91a50'

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:109)
at geb.spock.GebSpec.propertyMissing(GebSpec.groovy:60)
at specs.LomnidoBaseSpec.setupSpec(LomnidoBaseSpec.groovy:28)
Caused by: java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:71)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:57)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:60)
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:252)
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.<init>(ApacheHttpClient.java:229)
at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:96)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:70)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:58)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:87)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at script14601033971711755627056.run_closure5(script14601033971711755627056.groovy:81)
at script14601033971711755627056.run_closure5(script14601033971711755627056.groovy)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
... 9 more

When I run the test from command line with maven, everything works fine.

mvn -Dtest=specs.writeable.CreateDemoWorkflow test

My pom file:

<properties>
    <gebVersion>0.12.2</gebVersion>
    <seleniumVersion>2.53.0</seleniumVersion>
    <groovyVersion>2.4.3</groovyVersion>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF- 8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
  <groupId>org.codehaus.groovy</groupId>
  <artifactId>groovy-all</artifactId>
  <version>${groovyVersion}</version>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.8.1</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.spockframework</groupId>
  <artifactId>spock-core</artifactId>
  <version>1.0-groovy-2.4</version>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.gebish</groupId>
  <artifactId>geb-spock</artifactId>
  <version>${gebVersion}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-firefox-driver</artifactId>
  <version>${seleniumVersion}</version>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpcore</artifactId>
  <version>4.4.4</version>
</dependency>

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.5.2</version>
</dependency>

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>2.53.0</version>
</dependency>

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-chrome-driver</artifactId>
  <version>${seleniumVersion}</version>
  <scope>test</scope>
</dependency>


<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-support</artifactId>
  <version>2.53.0</version>
</dependency>

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>htmlunit-driver</artifactId>
  <version>2.20</version>
</dependency>

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-server</artifactId>
  <version>2.53.0</version>
</dependency>


<dependency>
  <groupId>com.saucelabs</groupId>
  <artifactId>sauce_junit</artifactId>
  <version>2.1.21</version>
  <scope>test</scope>
</dependency>

The trouble started after I go from version 2.48.2 to 2.53.0. Before everything worked fine. But I can not use the old version, the error stays.

When I delete all files in m2/repository/org/apache/httpcomponents, the tests can start. But when I run my grails application afterwards, older httpcomponents are downloaded and my test do not run any longer. In my project structure just the new jars are included

Peter
  • 1,011
  • 2
  • 16
  • 39
  • Check this link http://stackoverflow.com/questions/30085879/why-does-my-geb-test-return-failed-to-create-driver-from-callback-even-after-u – Jorge Apr 08 '16 at 08:57

1 Answers1

0

I found the solution: From other projects, there was this maven repository: /.m2/repository/org/apache/httpcomponents/httpcore/4.2.2

After deleting this folder, everything works fine. So I have to update the other project to use a new version

Peter
  • 1,011
  • 2
  • 16
  • 39