-
-
Save rahulmr/b715f6c5ac8b0be36de7d21ec6b656ae to your computer and use it in GitHub Desktop.
How To Download File Using Selenium Python?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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