在将Grails版本从2.3.6升级到2.4.5之后,我现在在运行Geb Spock测试时遇到了一个异常。
failed to create driver from callback 'script14328041759692122350870$_run_closure1@5fcdf5ea'
geb.driver.DriverCreationException: failed to create driver from callback 'script14328041759692122350870$_run_closure1@5fcdf5ea'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
at geb.Configuration.createDriver(Configuration.groovy:361)
at geb.Configuration.getDriver(Configuration.groovy:350)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.clearCookies(Browser.groovy:496)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:54)
at AuthorizationAdminSpec.setupSpec(AuthorizationAdminSpec.groovy:21)
Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/SchemePortResolver
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:234)
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.<init>(ApacheHttpClient.java:211)
at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:88)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:57)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
at script14328041759692122350870.run_closure1(script14328041759692122350870.groovy:12)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.SchemePortResolver
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 23 more
我记得在Grails 2.3.6中最初设置Geb时遇到过这个异常,其中BuildConfig和GebConfig文件没有正确配置。然而,在重新检查Geb所需的必要插件和依赖项时,我没有注意到Grails 2.4.5有任何不同。此外,我将依赖项解析从Ivy切换到Maven,因此我再次检查Maven资源以确保驱动程序已加载。
更多的信息...
grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "http://google-api-client-libraries.appspot.com/mavenrepo"
mavenRepo "http://mvnrepository.com/artifact/"
mavenRepo "http://repo.jenkins-ci.org/repo"
mavenRepo "http://repo.grails.org/grails/repo"
}
dependencies {
....
compile "org.springframework:spring-test:4.0.9.RELEASE"
test "org.gebish:geb-spock:0.10.0"
test "org.seleniumhq.selenium:selenium-support:2.45.0"
test "org.seleniumhq.selenium:selenium-firefox-driver:2.45.0"
}
plugins {
....
test ":geb:0.10.0"
}
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxProfile
reportsDir = "target/geb-reports"
baseUrl = "http://localhost:8090/adverity/"
driver = {
//set the firefox locale to 'en-us' since the tests expect english
//see http://stackoverflow.com/questions/9822717 for more details
FirefoxProfile profile = new FirefoxProfile()
profile.setPreference("intl.accept_languages", "en-us")
def driverInstance = new FirefoxDriver(profile)
driverInstance.manage().window().maximize()
driverInstance
}
baseNavigatorWaiting = true
atCheckWaiting = true
autoClearCookies = false
quitCachedDriverOnShutdown = false
我已经看过的地方...
test 'org.apache.httpcomponents:httpclient:4.3.2'
添加到BuildConfig.groovy中的dependencies部分
我没有意识到这种依赖性,因为我在任何文档中都没有看到它,但在堆栈跟踪中深入查看后,我发现情况并非如此。
我在一个扩展GebreportingSpec的类中尝试了这一点: 当然,我在setup()方法中创建了一个新的RemoteWebDriver。 使用这种方法,每个测试都得到一个独特的Sauce Connect会话,结果都以Sauce的形式组织得很好。但是,由于以下原因,所有测试都失败了:
堆栈跟踪如下: 结果StackTrace:在OpenQa.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)在OpenQa.Selenium.Remote.Remote.DriverServiceCommandExecutor.Execute(命令commandToExecute)在Ope
问题内容: 我正在尝试使用selenium升级到升级后的firefox Web浏览器自动化。selenium似乎需要木偶驱动程序才能继续工作。我按照开发人员的指示进行操作, 下载了驱动程序 重命名为wires.exe 以下代码无法正确地将PATH设置为自定义路径。 System.Environment.SetEnvironmentVariable(“ webdriver.gecko.driver”
对于ex,当我的chrome放在Compand提示符中时,会给出路径-/applications/google\chrome.app system.setproperty(“webdriver.chrome.driver”,“/applications/google/chrome.app”);WebDriver driver=new ChromeDriver(); driver.get(“http
从带有SP1的AEM 6.2升级到AEM 6.4后,很少有软件包未安装。旧版本处于已安装状态。 对于新软件包,显示消息为“似乎安装了另一个版本:”请参见下面的屏幕截图。 正因为如此,我可以看到很少的脚本没有更新最新的API。例如AEM 6.4升级实例:
一、简介 本章节主要介绍PHPCMS V9程序升级方式 二、目录 离线升级 在线升级