ruby - Watir Changing Mozilla Firefox Preferences -


i'm running ruby script using watir automate things me. i'm attempting automatically save files directory. so, in mozilla settings set default download directory desktop , choose automatically save files.

these changes, however, not reflected when begin run script. seems preferences revert default. i've included following

require "rubygems"         # optional. require "watir-webdriver"  # web automation. require "win32ole"         # file save dialog. 

and open new firefox instance with:

browser = watir::browser.new(:firefox) 

any ideas on why preferences set this? or alternative ideas trying do? (automatically save files).

thanks

webdriver uses clean profile each browser instance, why preferences appear "reset". can tell use default profile:

watir::browser.new :firefox, :profile => "default"  

or tweak profile preferences programatically before launching browser:

profile = selenium::webdriver::firefox::profile.new profile['some.preference'] = true profile.add_extension "/path/to/some/extension.xpi"  watir::browser.new :firefox, :profile => profile 

for example of configuring automatic file downloads, see this section on selenium wiki.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -