Skip to content

Instantly share code, notes, and snippets.

@rahulmr
Forked from SarahElson/conftest.py
Created September 28, 2022 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulmr/b715f6c5ac8b0be36de7d21ec6b656ae to your computer and use it in GitHub Desktop.
Save rahulmr/b715f6c5ac8b0be36de7d21ec6b656ae to your computer and use it in GitHub Desktop.
How To Download File Using Selenium Python?
import unittest
from selenium import webdriver
class Browser(unittest.TestCase):
def setUp(self):
PATH = "/Users/macbookair/Desktop/how_download_files_selenium_python/download"
#Mozilla Firefox
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", PATH)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/x-gzip")
self.driver = webdriver.Firefox(firefox_profile=profile)
self.driver.get("https://www.lambdatest.com/selenium-playground/")
def tearDown(self):
self.driver.close()
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment