问题
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