Reputation: 3133
I downloaded the Chromedriver then I extracted it to the right place (usr/bin), but I don't know what is the default profile name for the Chrome (Chromium) browser, so this line throw an error message:
browser = Watir::Browser.new :chrome, :profile => "default"
I tried either "current" or my username instead of "default", but none of them worked. How can I start Chrome with my default profile? Because I don't want to start a new profile without the usual preferences, and saved passwords, cookies, etc.
Upvotes: 3
Views: 2513
Reputation: 2493
You can see you default path at chrome://version/
url
In my case it is /Users/mikhail/Library/Application Support/Google/Chrome/Default
For some reason proper path would be this string without last '/Default' part of the path:
require 'watir-webdriver'
username = 'mikhail'
switches = %W[--user-data-dir=/Users/#{username}/Library/Application\ Support/Google/Chrome/]
browser = Watir::Browser.new :chrome, switches: switches
browser.goto 'google.com'
Upvotes: 1
Reputation: 247
I use chrome profile options to handle downloading files
download_directory = "/path/youwant/files/dowloaded/to"
profile = Selenium::WebDriver::Chrome::Profile.new
profile['download.prompt_for_download'] = false
profile['download.default_directory'] = download_directory
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
b = Watir::Browser.new :chrome, :profile => profile
see here for more info on chromedriver profile options http://src.chromium.org/svn/trunk/src/chrome/common/pref_names.cc
Upvotes: 1
Reputation: 57322
I am not sure Chrome has that option (like Firefox has). I could not find it at http://watirwebdriver.com/chrome/
Upvotes: 0