我正在尝试使用geb在Microsoft Edge浏览器上自动化网站。测试脚本在IE和Chrome上正常运行但在Edge浏览器上出错。错误是:
org.openqa.selenium.WebDriverException: ÀՉ았Չtor not implemented (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:20:39.408Z'
System info: host: 'NAG1-LDL-41716', ip: '172.18.8.41', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.edge.EdgeDriver
Capabilities {acceptSslCerts: true, browserName: MicrosoftEdge, browserVersion: 20.10240.17146.0, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10, takesElementScreenshot: true, takesScreenshot: true}
Session ID: 5627381E-0A38-4DE4-BF2C-71FC625049F6
*** Element info: {Using=xpath, value=/*}
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.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
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.findElement(RemoteWebDriver.java:371)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:473)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at geb.navigator.factory.BrowserBackedNavigatorFactory.createBase(BrowserBackedNavigatorFactory.groovy:39)
at geb.navigator.factory.BrowserBackedNavigatorFactory.getBase(BrowserBackedNavigatorFactory.groovy:45)
at geb.content.NavigableSupport.getBase(NavigableSupport.groovy:34)
at geb.content.NavigableSupport.module(NavigableSupport.groovy:207)
at geb.content.PageContentTemplateFactoryDelegate.module(PageContentTemplateFactoryDelegate.groovy:31)
at pages.EbayHomePage._clinit__closure2$_closure3(EbayHomePage.groovy:15)
at pages.EbayHomePage._clinit__closure2$_closure3(EbayHomePage.groovy)
at geb.content.PageContentTemplate.invokeFactory(PageContentTemplate.groovy:98)
at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy:59)
at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy)
at geb.content.PageContentTemplate.create(PageContentTemplate.groovy:83)
at geb.content.PageContentTemplate.get(PageContentTemplate.groovy:54)
at geb.content.DefaultPageContentSupport.getContent(DefaultPageContentSupport.groovy:42)
at geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:39)
at geb.Page.propertyMissing(Page.groovy:112)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:312)
at groovy.lang.Closure.getPropertyDelegateFirst(Closure.java:302)
at groovy.lang.Closure.getProperty(Closure.java:287)
at tests.SearchTest.Searching iPhone 6_closure2(SearchTest.groovy:20)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at tests.SearchTest.Searching iPhone 6(SearchTest.groovy:19)
org.openqa.selenium.WebDriverException: not implemented (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:20:39.408Z'
System info: host: 'NAG1-LDL-41716', ip: '172.18.8.41', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.edge.EdgeDriver
Capabilities {acceptSslCerts: true, browserName: MicrosoftEdge, browserVersion: 20.10240.17146.0, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10, takesElementScreenshot: true, takesScreenshot: true}
Session ID: 5627381E-0A38-4DE4-BF2C-71FC625049F6
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.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
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.execute(RemoteWebDriver.java:658)
at org.openqa.selenium.remote.RemoteWebDriver.getPageSource(RemoteWebDriver.java:483)
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:931)
at geb.spock.GebReportingSpec.report(GebReportingSpec.groovy:59)
at geb.spock.GebReportingSpec.cleanup(GebReportingSpec.groovy:46)
Starting server...
Fully qualified URI to listen on: http://localhost:22259/
Waiting for new request...
Received a request for http://localhost:22259/status
Waiting for new request...
Received a request for http://localhost:22259/session
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/url
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/url
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/title
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/title
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/title
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/element
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/source
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/source
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6/cookie
Waiting for new request...
Received a request for http://localhost:22259/session/5627381E-0A38-4DE4-BF2C-71FC625049F6
Waiting for new request...
Received a request for http://localhost:22259/shutdown
Stopping server.
我的测试文件是:
class SearchTest extends GebReportingSpec{
def "Searching iPhone 6"(){
given:
to EbayHomePage
when:
waitFor {at(EbayHomePage)}
at(EbayHomePage).with {
headerW.searchField.value("iPhone 6")
headerW.selectCategory.setSelected("Mobile Phones")
headerW.searchButton.click()
}
waitFor 10, {at(SearchResultPage).itemTitle.isDisplayed()}
String itemName = at(SearchResultPage).itemTitle.text()
at(SearchResultPage).itemTitle.click()
then:
assert at(ItemDetailsPage).itemName.text()==itemName
}
}
我的GebConfig.groovy是:
driver = { System.setProperty("webdriver.edge.driver","D:\\Project\\gebbrowserautomation\\MicrosoftWebDriver.exe");
driver = { new EdgeDriver() }
}
baseUrl = "https://www.ebay.in"
reportsDir = "build/reports/GebReports"
EBayHomePage.groovy是:
class EbayHomePage extends Page{
static url = "/"
static at = { title == "Electronics, Cars, Fashion, Collectibles, Coupons and More | eBay"}
static content = {
headerW {module(HeaderModule)}
profileModule {module(ProfileModule)}
}
}
HeaderModule.groovy:
class HeaderModule extends Module{
static content = {
signIn {$("a", text:"Sign in")}
register {$("a", text:"register")}
deals {$("a", _sp:"m570.l3188")}
sell {$("a", _sp:"m570.l1528")}
help {$("a", _sp:"m570.l1545")}
trackOrder {$("a", _sp:"m570.l2624")}
myEbay {$("a", _sp:"m570.l2919")}
myPaisaPay {$("a.gh-eb-li-a")}
profileExpand {$("#gh-ug")}
searchField {$("#gh-ac")}
selectCategory {$("#gh-cat").module(Select)}
searchButton {$("#gh-btn")}
}
}
ProfileModule.groovy:
class ProfileModule extends Module{
static content = {
username {$("li#gh-un")}
userId {$("#gh-ui")}
accountSettings {$("a", _sp:"m570.l3399")}
signout {$("#gh-uo")}
}
}
有人可以帮我解决这个问题吗?我不确定,但它看起来像MicrosoftEdgeDriver问题。