使用 WebDriver 运行 codeception 时出现错误“[PHPUnit\Framework\Exception] 未定义索引:ELEMENT”

电影

我正在尝试使用 WebDriver 运行 codeceptions 验收测试。我目前的设置如下:

  • 拱形Linux
  • Chromium:Chromium 75.0.3770.80 Arch Linux
  • 包含的 chromedriver 版本:ChromeDriver 75.0.3770.80 (9a9aa15057b6b2cc0909bdcf638c0b65ecd516f2-refs/branch-heads/3770@{#948})
  • Selenium 服务器:Selenium 服务器版本:3.14.0,修订版:aacccce0

我通过运行来执行 seleniumenv webdriver.chrome.driver="chromedriver" java -jar /usr/share/selenium-server/selenium-server-standalone.jar -port 5555 &但是当我运行验收测试时,我收到[PHPUnit\Framework\Exception] Undefined index: ELEMENT每个测试的错误Chromium 正确启动,加载当前 url,但无法执行任何其他操作。

我研究了这个问题,发现过去 geckodriver 也有类似的问题。它可以通过传递-enablePassThrough false给硒来修复然而,在 selenium 3.9 中删除了直通模式。这里的解决方法是简单地切换到 chromedriver。但是,由于我已经在使用 chromedriver,因此这对我不起作用。铬不支持 w3c 规范是否有可能?Chromium 和 Chrome 在支持 Selenium 方面有什么区别吗?

selenium的输出:启动selenium:

11:39:58.474 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.14.0', revi
11:39:58.478 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 5555
2019-06-07 11:39:58.689:INFO::main: Logging initialized @558ms to org.seleniumhq.jetty9.util.log.StdErrLog
11:39:58.895 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555

开始代码接收测试

11:40:24.577 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "chromeOptions": {
    "args": [
      "--disable-gpu"
    ]
  }
}
11:40:24.580 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server
Starting ChromeDriver 75.0.3770.80 (9a9aa15057b6b2cc0909bdcf638c0b65ecd516f2-refs/branch-heads/3770@{#948})
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
11:40:26.065 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
11:40:26.130 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 0c80ffc4e6c160d2817ab60ced6a279f (org.openqa.selenium.chrome.ChromeDriverService)

验收测试应该没问题,因为它们在我的 CI-Pipeline 中运行良好

夜店

php-webdriver 库还不支持w3c模式。您可以将其w3c: false作为获取旧行为的必需功能进行传递
但更可靠的选择是使用 ChromeDriver v74。

更多信息可以在这张票https://github.com/facebook/php-webdriver/issues/469#issuecomment-499519728 中找到

更新:facebook/webdriver升级到 1.7.0 版本也应该解决这个问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

Related 相关文章

热门标签

归档