user1617707
user1617707

Reputation: 61

How to check the location of download folder programmatically in browsers like Safari, Firefox etc on Mac?

I am a part of Automation testing and I am downloading and installing the files programmatically with Selenium and Applescript on Mac. Is their any way to check the location of download folder on browsers programmatically?? if so pls suggest and also ways to change the location of download folder in Java or Applescript.

Upvotes: 0

Views: 993

Answers (2)

abuuu
abuuu

Reputation: 377

may be you can try like this on firefox:

profile = Selenium::WebDriver::Firefox::Profile.new

profile['browser.download.dir'] = "/tmp/webdriver-downloads"

profile['browser.download.folderList'] = 2

profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf"

b = Watir::Browser.new :firefox, :profile => profile

Upvotes: 1

Lri
Lri

Reputation: 27613

Safari has a preference for it in ~/Library/Preferences/com.apple.Safari.plist:

defaults read com.apple.Safari DownloadsPath

You can also change it by modifying the property list, but the changes aren't applied until Safari is reopened.

defaults write com.apple.Safari DownloadsPath "~/Desktop"

Upvotes: 0

Related Questions