Headless Selenium replacing file that is being downloaded

Viewed 58

I am using selenium headless to download files from dropdown options. As the files are being downloaded after each iteration the first file is getting replaced.

When disabling the headless mode the files get downloaded as I want it a.csv(1), a.csv(2), a.csv(3),

My chrome options are as follows

options = webdriver.ChromeOptions() 
options.add_argument('--no-sandbox')
options.add_argument('--headless')
options.add_argument('--disable-dev-shm-usage')
prefs = {"download.default_directory" : curr_dir}
options.add_experimental_option("prefs",prefs)
driver=webdriver.Chrome(options=options)

Is there a way to have a behavior similar to non headless mode. Or do I manually rename files after they are downloaded.

0 Answers
Related