prevent watir-webdriver running chrome as a first run

痞子三分冷 提交于 2019-12-13 17:31:09

问题


Everytime I use watir-webdriver to initialise a chrome browser instance, it launches as a first-run with an EULA pop-up and an additional getting-started tab open.

Both of these side-effects are preventing me from automating tests for chrome.

I have tried initialising a browser using just

Selenium::WebDriver.for :chrome, :switches => %w[--no-first-run]

but have the same result.

I am surprised to be unable find any other questions online about this, so assume I have done something weird!

I have placed chromedriver.exe in C:\Program Files (x86)\Google\Chrome\Application which is on my PATH variable.

Any ideas?


回答1:


I have found a solution for this. In C:\Program Files (x86)\Google\Chrome\Application there is a file called master_preferences.

Opening this file and setting:

require_eula to false

show_welcome_page to false

fixed both issues for me.

Hopefully this helps someone!




回答2:


I would put the chromedriver.exe on your PATH, so somewhere like C:/windows/system32 or the like, or you could add the directory C:\Program Files (x86)\Google\Chrome\Application to your PATH (right click My Computer -> Advanced -> Environment Variables)

It should then run OK.



来源:https://stackoverflow.com/questions/9838760/prevent-watir-webdriver-running-chrome-as-a-first-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!