简体   繁体   English

Capybara Selenium Chrome打开关于谷歌浏览器

[英]Capybara Selenium Chrome opens About Google Chrome

I have an issue with testing in Chrome. 我在Chrome中进行测试存在问题。 When I run the test it opens the chrome://settings/help page in a new tab. 当我运行测试时,它会在新选项卡中打开chrome:// settings / help页面。 This causes my tests to fail as it can't find the buttons it should click on. 这导致我的测试失败,因为它找不到它应该单击的按钮。 I was debugging in Chrome in normal mode when I saw what happend. 当我看到发生的事情时,我正在正常模式下在Chrome中进行调试。

Can I prevent this from happening? 我可以防止这种情况发生吗? Or can I keep the tab where I'm testing in focussed in some way? 或者我可以以某种方式保持我正在测试的选项卡?

I ran into the same issue this morning. 今天早上我遇到了同样的问题。 All our tests were failing because chrome://settings/help was automatically opened when we ran our selenium tests. 我们所有的测试都失败了,因为当我们运行硒测试时, chrome://settings/help会自动打开。

This behaviour did not happen when we used Chrome 61, and suddenly appeared when it got updated to Chrome 62. 当我们使用Chrome 61时,这种情况不会发生,并且在更新到Chrome 62时突然出现。

In order to fix that we had to update the chromedriver binary to the latest version. 为了解决这个问题,我们必须将chromedriver二进制文件更新为最新版本。 You can find the drivers on here https://chromedriver.storage.googleapis.com/index.html 您可以在这里找到驱动程序https://chromedriver.storage.googleapis.com/index.html

Our tests are now running normally again. 我们的测试现在再次正常运行。

To add to Germain's comment, since I had a hard time remembering how to update the chromedriver -- I'm on a mac and originally installed it using brew, so now I had to do a 'brew upgrade chromedriver'. 要添加到Germain的评论,因为我很难记住如何更新chromedriver - 我在Mac上并且最初使用brew安装它,所以现在我必须做一个'brew upgrade chromedriver'。 Also probably a good idea to restart spring if you're using that for your tests. 如果您正在使用它进行测试,重启spring也可能是一个好主意。

if anyone using this chromedriver-helper . 如果有人使用这个chromedriver-helper Then update the chromedriver as mentioned here . 然后更新这里提到的chromedriver I updated to 2.33 and error is solved. 我更新到2.33并且错误已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM