jw
unread,Sep 16, 2011, 8:18:55 PM9/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Watir General
ruby 187
selenium-webdriver (2.6.0)
watir (2.0.1)
watir-webdriver (0.3.3)
It looks like FF (3.6.6) has some issues with the DL path setting:
browserProfile['browser.download.dir'] = "C:\my\new\dir"
1) it seems the string you pass must use backslashes and must contain
the drive letter
2) this example path will not work because webdriver first makes a
file called user.js which has a line like:
user_pref("browser.download.dir", "C:\my\new\dir");
but when FF starts up it creates prefs.js which will have a line like:
user_pref("browser.download.dir", "C:\\my\new\\dir");
where the \ before the 'n' is lost. It does the same thing for '\r'
so I put in a hack in my classExtensions file that looks like:
module Selenium
module WebDriver
module Firefox
class Profile
def write_prefs(prefs, path)
File.open(path, "w") { |file|
prefs.each do |key, value|
if (key['download'] and value.kind_of?(String))
value.gsub!(/\\n/, '\\\\\\n')
value.gsub!(/\\r/, '\\\\\\r')
end
file.puts %{user_pref("#{key}", #{value});}
end
}
puts path
end
end
end
end
end