这是他们网站上的代码,但我不明白该怎么做。我对 Ruby 还是很陌生。
download_directory = "#{Dir.pwd}/downloads"
download_directory.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.folderList'] = 2 # custom location
profile['browser.download.dir'] = download_directory
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
b = Watir::Browser.new :firefox, :profile => profile
我正在尝试将当前 url 下载为 .html 文件,让浏览器转到该文件。尽你所能,请帮忙,谢谢:)