当我使用 ruby watir 在 chrome 网络浏览器中单击网页链接时
ie.input(:id, "c_ImageButton_Text").click
.text 文件开始下载。我想将其下载到特定位置。我尝试了此代码,但仍然在默认下载位置获取 .text 文件。如何将 .text 文件下载到特定位置?
download_directory = "#{Dir.pwd}/downloads"
download_directory.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
profile = Selenium::WebDriver::Chrome::Profile.new
profile['download.prompt_for_download'] = false
profile['download.default_directory'] = download_directory
b = Watir::Browser.new :chrome, :profile => profile