Selenium HTML Runner 失败,权限被拒绝

Posted

技术标签:

【中文标题】Selenium HTML Runner 失败,权限被拒绝【英文标题】:Selenium HTML Runner fails with permission denied 【发布时间】:2017-12-30 07:01:26 【问题描述】:

我在 Raspberry Pi 3 上安装了 Firefox 45.9.0、Selnium 3.4 html Runner 和 geckodriver 0.18。我正在运行它

java -jar selenium-html-runner-3.4.0.jar -htmlSuite "*firefox" "http://localhost:88" /home/michal/abc/suite.html /home/michal/abc

但是像clickAndWaittype 这样的一些命令失败,结果文件中出现权限被拒绝错误。

com.thoughtworks.selenium.SeleniumException: Error: Permission denied to access property '__webdriverAlerts'

输出打印到标准输出

Multi-window mode is longer used as an option and will be ignored.
1500909971572   geckodriver     INFO    geckodriver 0.18.0
1500909971595   geckodriver     INFO    Listening on 127.0.0.1:25370
1500909972680   geckodriver::marionette INFO    Starting browser /usr/bin/firefox with args ["-marionette"]
Čvc 24, 2017 5:26:22 ODP. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2017-07-24 17:26:23.090:INFO::main: Logging initialized @13587ms to org.seleniumhq.jetty9.util.log.StdErrLog
2017-07-24 17:26:23.289:INFO:osjs.Server:main: jetty-9.4.z-SNAPSHOT
2017-07-24 17:26:23.371:INFO:osjsh.ContextHandler:main: Started o.s.j.s.h.ContextHandler@5c8d3f/tests,null,AVAILABLE
2017-07-24 17:26:23.415:INFO:osjs.AbstractConnector:main: Started ServerConnector@1c1b556HTTP/1.1,[http/1.1]0.0.0.0:15196
2017-07-24 17:26:23.417:INFO:osjs.Server:main: Started @13915ms
Čvc 24, 2017 5:26:25 ODP. org.openqa.selenium.server.htmlrunner.CoreTestCase run
INFO: |open | http://localhost:88/ |  |
Čvc 24, 2017 5:26:26 ODP. org.openqa.selenium.server.htmlrunner.CoreTestCase run
INFO: |selectWindow | null |  |
Čvc 24, 2017 5:26:26 ODP. org.openqa.selenium.server.htmlrunner.CoreTestCase run
INFO: |clickAndWait | link=Blog |  |
test.html
<a href="test.html">test</a></td></tr>
</tbody></table>
2017-07-24 17:26:27.414:INFO:osjs.AbstractConnector:main: Stopped ServerConnector@1c1b556HTTP/1.1,[http/1.1]0.0.0.0:15196
2017-07-24 17:26:27.416:INFO:osjsh.ContextHandler:main: Stopped o.s.j.s.h.ContextHandler@5c8d3f/tests,null,UNAVAILABLE
Čvc 24, 2017 5:26:27 ODP. org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Čvc 24, 2017 5:26:29 ODP. org.openqa.selenium.os.UnixProcess destroy
INFO: Command failed to close cleanly. Destroying forcefully (v2). [/home/michal/selenium/geckodriver, --port=25370, -b, /usr/bin/firefox][ ]
Čvc 24, 2017 5:26:30 ODP. org.openqa.selenium.os.UnixProcess destroy
SEVERE: Unable to kill process with PID 4786
Čvc 24, 2017 5:26:30 ODP. org.openqa.selenium.server.htmlrunner.HTMLLauncher mainInt
WARNING: Test of browser failed: *firefox
org.openqa.selenium.WebDriverException: quit
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'raspberrypi', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'arm', os.version: '4.9.35-v7+', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [rotatable=false, raisesAccessibilityExceptions=false, appBuildId=20170419042421, version=45.9.0, platform=LINUX, proxy=Proxy(), specificationLevel=1, acceptSslCerts=false, browserVersion=45.9.0, platformVersion=4.9.35-v7+, XULappId=ec8030f7-c20a-464f-9b0e-13a3a9e97384, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, javascriptEnabled=true, platformName=Linux, device=desktop]
Session ID: 19afb854-e7b4-4e84-807e-62a9c6ece5f4
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:694)
        at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:533)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:139)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.mainInt(HTMLLauncher.java:245)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.main(HTMLLauncher.java:273)

在 geckodriver github 页面 https://github.com/mozilla/geckodriver/releases 我发现 geckodriver 0.18 建议与 Firefox 53+ 一起使用,但是当我选择较旧的 geckodriver 时,输出结果是相同的。

仅基于打开和验证命令的测试有效。如何进行所有测试?

【问题讨论】:

Weir 你说在版本 49 中使用 ff,但在版本 45 中调试有关 ff 的错误信息,尝试使用 selenium v​​ 2.53,因为此版本不支持 ff v45 和属性版本 geckodrive for ff v45 非常感谢。 Firefox 版本真的是 45。我已经在帖子中修复了它。我尝试了 selenium 2.53.1,它可以工作。非常感谢。将其粘贴为答案,赏金就是你的了。 【参考方案1】:

将 selenium 更改为 2.53 版本。您使用的是 firefox 45 版,而此版本不适用于 selenium v​​3.4。

【讨论】:

以上是关于Selenium HTML Runner 失败,权限被拒绝的主要内容,如果未能解决你的问题,请参考以下文章

Maven依赖项冲突selenium-firefox-driver vs tint-runner

Runner.app/Runner.app/...无限循环Xcode构建失败

第二轮冲刺-Runner站立会议04

JAVA - Apache BEAM- GCP:GroupByKey 与 Direct Runner 一起工作正常,但与 Dataflow runner 一起失败

gitlab ssh runner 失败。怎么了?

selenium启动Firefox失败