0

当我运行“polymer test --skip-selenium-install”时运行“无法建立新会话”时出现此错误

error: [cli.main]   Error: {"value":{"stacktrace":"org.openqa.selenium.SessionNotCreatedException: Cannot establish new session\nBuild info: version: \u00273.8.1\u0027, revisi
on: \u00276e95a6684b\u0027, time: \u00272017-12-01T19:05:32.194Z\u0027\nSystem info: host: \u0027WDU8L0001186\u0027, ip: \u002710.244.11.110\u0027, os.name: \u0027Windows 7\u0
027, os.arch: \u0027x86\u0027, os.version: \u00276.1\u0027, java.version: \u00271.8.0_172\u0027\nDriver info: driver.version: unknown\r\n\tat org.openqa.selenium.remote.server
.ServicedSession$Factory.apply(ServicedSession.java:261)\r\n\tat org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$11(ActiveSessionFactory.java:167)\r\n\tat

...

e":"Cannot establish new session\nBuild info: version: \u00273.8.1\u0027, revision: \u00276e95a6684b\u0027, time: \u00272017-12-01T19:05:32.194Z\u0027\nSystem info: host: \u00
27WDU8L0001186\u0027, ip: \u002710.244.11.110\u0027, os.name: \u0027Windows 7\u0027, os.arch: \u0027x86\u0027, os.version: \u00276.1\u0027, java.version: \u00271.8.0_172\u0027
\nDriver info: driver.version: unknown","error":"session not created"},"status":33}
    at C:\Users\D-CA69TO\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\web-component-tester\runner\steps.js:170:27
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\D-CA69TO\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\web-component-tester\runner\steps.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

通过谷歌搜索,我发现这可能是由 Selenium、ChromeDriver 和 Chrome 的错误组合引起的。好吧,我的 Chrome 版本是 66.0.3359.117(官方构建)(32 位),但我如何检查使用了哪个 Selenium 和 ChromeDriver?老实说,我不记得我安装了它们,所以我认为 polymer-cli 以某种方式为我做了这个。

*** 根据 Corey 的建议编辑

C:\>chromedriver -v
'chromedriver' is not recognized as an internal or external command,
operable program or batch file.
4

1 回答 1

1

获取 chromedriver 版本:chromedriver -v

如果您安装了 selenium python 绑定,则可以使用以下命令检查版本:python -c "import selenium; print(selenium.__version__)"

例如,在 shell 中,您可以执行以下操作:

$ chromedriver -v
ChromeDriver 2.36 (0)
$ python -c "import selenium; print(selenium.__version__)"
3.11.0
于 2018-06-14T01:24:57.743 回答