Scenario: There is a requirement of downloading files from web hierarchy to local drive under same hierarchy.
Example Web Hierarchy:
Parent 1:
Child 1:
*File 1
Child 2:
*File 2
When downloading File 1, it should store in path 1 - "C:....DownloadsParent 1Child 1"
When downloading File 2, it should store in path 2 - "C:....DownloadsParent 1Child 2"
Problem:
When I keep "C:....DownloadsParent 1Child 1" download path in chrome webdriver while initializing webdriver first time in setUp() & download "File 1", it downloads in expected folder.
But when I set next "C:....DownloadsParent 1Child 2" download path in chrome webdriver for downloading File 2 in it, it opens another chrome browser because I am using another webdriver for setting path 2.
Required Solution:
I want to use existing webdriver to set different chrome download paths or any other workaround you can think of.
Current Code:
def setUp(self):
browser = webdriver.Chrome(chromedriver_path, option_with_path_1_set)
def test_downloadFiles(self):
*code to download first file*
driver = webdriver.Chrome(chromedriver_path, option_with_path_2_set)
*code to download second file*
def tearDown(self):
browser.quit()
Please let me know if you require any additional information.
Thanks in advance!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…