Created
August 12, 2022 14:05
-
-
Save SarahElson/c102b92b477743e4c59a9f62df486c71 to your computer and use it in GitHub Desktop.
How To Download File Using Selenium Python?
This file contains hidden or 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 | |
from selenium.webdriver.chrome.options import Options | |
class Browser(unittest.TestCase): | |
def setUp(self): | |
PATH = "/Users/macbookair/Desktop/how_download_files_selenium_python/download" | |
#Google Chrome | |
options = Options() | |
prefs = {"download.default_directory" : PATH} | |
options.add_experimental_option("prefs",prefs) | |
self.driver = webdriver.Chrome(options=options) | |
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