Selenium HTML Runner失败,权限被拒绝

时间:2017-07-24 15:46:02

标签: java selenium firefox raspberry-pi3 geckodriver

我在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'

输出打印到stdout

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@1c1b556{HTTP/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@1c1b556{HTTP/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时输出结果是相同的。

仅基于open和verify命令的测试有效。我怎样才能完成所有测试?

1 个答案:

答案 0 :(得分:2)

将selenium更改为2.53版本。你使用firefox版本45,这个版本不适用于selenium v​​3.4。