Selenium Grid 2 - Chromedriver Does Not Launch a New Profile on New Launch

When testing a website in Chrome using selenium webdriver ( chromedriver ) using ruby and selenium grid 2 I manually clicked Allow to track my location.

Since then, each new launch starts with a Chrome browser that tracks my location and does not request permission.

In my understanding, this should not be, since Selenium should create a new profile and not remember any user interactions in the previous run.

I also tried to open the Chrome browser as an administrator (manually) and change the settings to forget any permissions set for location services for the site being checked. But that didn't help either.

I also tried restarting the grid, but that didn't help either.

Does anyone know how to make the browser forget my permission?

UPDATE

Code to run the driver

 @driver = Selenium::WebDriver.for(:remote, :url => @sel_grid_url, :desired_capabilities => @browser) 
0
source share
2 answers

Try it.

 profile = Selenium::WebDriver::Chrome::Profile.new data = profile.as_json caps = Selenium::WebDriver::Remote::Capabilities.chrome caps['chromeOptions'] = { 'profile' => data['zip'], 'extensions' => data['extensions'] } driver = Selenium::WebDriver.for(:remote, :url => @sel_grid_url, :desired_capabilities => caps) 

Also make sure you have the Ask me when a site tries to track my physical location (recommended) option, under Settings -> Advanced Settings -> Privacy -> Content Settings -> Location .

Update:

One more attempt.

 profile = Selenium::WebDriver::Chrome::Profile.new profile['download.prompt_for_download'] = false profile['download.default_directory'] = "/path/to/dir" profile['profile.managed_default_content_settings.geolocation'] = 2 #Try 1 and 0 as well data = profile.as_json caps = Selenium::WebDriver::Remote::Capabilities.chrome caps['chromeOptions'] = { 'profile' => data['zip'], 'extensions' => data['extensions'] } driver = Selenium::WebDriver.for(:remote, :url => @sel_grid_url, :desired_capabilities => caps) 
+1
source

Try this for a local WebDriver fix:

 @driver = Selenium::WebDriver.for(:chrome, :no_website_testing_defaults => true, :switches => %w[--disable-geolocation]) 

To do this remotely, I think it will probably look something like this:

 caps = Selenium::WebDriver::Remote::Capabilities.chrome(:no_website_testing_defaults => true, :switches => %w[--disable-geolocation]) @driver = Selenium::WebDriver.for(:remote, :desired_capabilities => caps) 

See the RubyBindings documentation for information on using the https://code.google.com/p/selenium/wiki/RubyBindings#Chrome radio buttons

You can view a list of Chrome switches here: http://peter.sh/experiments/chromium-command-line-switches/

Update

It seems that Chromedriver must first disable the default testing before some settings (e.g. geolocation tracking) can be set (this is in line with the revision of the ChromeDriver Capabilities wiki found here: http://wiki.chromedriver.googlecode.com/ git-history / c790ec6b0b32a31a8797a0fa97b7f4dccb4f5da4 / CapabilitiesAndSwitches.wiki ).

I updated the code above to include the configuration to disable default testing (see http://code.google.com/p/chromium/issues/detail?id=113884 and http://code.google.com / p / selenium / issues / detail? id = 4622 ).

Please make sure you are using selenium-webdriver 2.26.0 and higher.

0
source

All Articles