0

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.

user1617707
  • 61
  • 1
  • 12

2 Answers2

1

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

abuuu
  • 367
  • 3
  • 14
0

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"
Lri
  • 26,768
  • 8
  • 84
  • 82
  • thanku so much this helped me for safari.. any idea on Firefox?? I tried this command but didinot work - defaults read $HOME/Library/Preferences/org.mozilla.firefox NSNavLastRootDirectory – user1617707 Oct 22 '12 at 11:22
  • Safari 13 seems to have broken `defaults write com.apple.safari DownloadsPath`. Any idea what the new preference is? – jhfrontz Oct 24 '19 at 16:38