将webdrivermanager.properties文件与Artifactory

时间:2018-06-05 14:08:43

标签: selenium webdrivermanager-java

感谢您对该项目的持续开发/改进。它是非常有用和功能齐全的;)我一直在使用本地运行测试,它工作得很好 - 因为我试图将事情转向纯CI设置;此外,希望利用Docker和本地Artifactory浏览器二进制文件。

在设置过程中 - 我注意到webdrivermanager.properties中的URL在通过Artifactory完成同样的操作时呈现XML文件,它给了我一个HTML索引目录页面使用给定浏览器二进制文件的所有版本。

错误输出如下:

`[chrome] Operating System: Linux
[chrome] 2018-06-05 13:58:09 WebDriverManager [main] [INFO]Reading https://artifactory.mycompany.com/chromedriver/ to seek chromedriver
[chrome] [Fatal Error] :1:55: White spaces are required between publicId and systemId.
[chrome] 2018-06-05 13:58:09 WebDriverManager [main] [ERROR]There was an error managing chromedriver 2.25 (org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55; White spaces are required between publicId and systemId.)
[chrome] io.github.bonigarcia.wdm.WebDriverManagerException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55; White spaces are required between publicId and systemId.
[chrome]      at io.github.bonigarcia.wdm.WebDriverManager.getDriversFromXml(WebDriverManager.java:797)
[chrome]      at io.github.bonigarcia.wdm.ChromeDriverManager.getDrivers(ChromeDriverManager.java:54)
[chrome]      at io.github.bonigarcia.wdm.WebDriverManager.filterCandidateUrls(WebDriverManager.java:492)
[chrome]      at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:442)
[chrome]      at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:219)
[chrome]      at controllers._BrowserFactory.StartBrowser(_BrowserFactory.java:84)
[chrome]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[chrome]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[chrome]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[chrome]      at java.lang.reflect.Method.invoke(Method.java:498)
[chrome]      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
[chrome]      at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
[chrome]      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:455)
[chrome]      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
[chrome]      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
[chrome]      at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:168)
[chrome]      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
[chrome]      at org.testng.TestRunner.privateRun(TestRunner.java:648)
[chrome]      at org.testng.TestRunner.run(TestRunner.java:505)
[chrome]      at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
[chrome]      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
[chrome]      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
[chrome]      at org.testng.SuiteRunner.run(SuiteRunner.java:364)
[chrome]      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
[chrome]      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
[chrome]      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
[chrome]      at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
[chrome]      at org.testng.TestNG.runSuites(TestNG.java:1049)
[chrome]      at org.testng.TestNG.run(TestNG.java:1017)
[chrome]      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
[chrome]      at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
[chrome]      at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
[chrome]      at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
[chrome]      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
[chrome]      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)
[chrome] Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55; White spaces are required between publicId and systemId.
[chrome]      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
[chrome]      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
[chrome]      at io.github.bonigarcia.wdm.WebDriverManager.loadXML(WebDriverManager.java:807)
[chrome]      at io.github.bonigarcia.wdm.WebDriverManager.getDriversFromXml(WebDriverManager.java:786)
[chrome]      ... 34 more
`

我确实遇到过类似的帖子https://github.com/bonigarcia/webdrivermanager/issues/157,但我希望你有任何想法。关于这个问题的替代方法。

非常感谢, 萨米尔

1 个答案:

答案 0 :(得分:0)

答案仍然与您issue上的答案相同。要查找<?xml version="1.0" encoding="UTF-8"?> <ListBucketResult xmlns="http://doc.s3.amazonaws.com/2006-03-01"> <Name>chromedriver</Name> <Prefix /> <Marker /> <IsTruncated>false</IsTruncated> <Contents> <Key>2.0/chromedriver_linux32.zip</Key> <Generation>1380149859530000</Generation> <MetaGeneration>2</MetaGeneration> <LastModified>2013-09-25T22:57:39.349Z</LastModified> <ETag>"c0d96102715c4916b872f91f5bf9b12c"</ETag> <Size>7262134</Size> </Contents> <Contents> <Key>2.0/chromedriver_linux64.zip</Key> <Generation>1380149860664000</Generation> <MetaGeneration>2</MetaGeneration> <LastModified>2013-09-25T22:57:40.449Z</LastModified> <ETag>"858ebaf47e13dce7600191ed59974c09"</ETag> <Size>7433593</Size> </Contents> ... </ListBucketResult> 个可用二进制文件的列表,WebDriverManager会解析位于某个在线存储库(默认为https://chromedriver.storage.googleapis.com/)上的XML。

因此,您的存储库https://artifactory.mycompany.com/chromedriver/必须返回具有以下格式的XML(而不是HTML),这是WebDriverManager期望的格式:

then(data => {
    data.map(message => this.setState({messages:message}))
})