File Download at Custom Path in Selenium with C#

This blog will show you how to download files from websites and save them to a folder. When you use selenium to download a file from a website, the file is saved in the default download folder. Chrome options must be used to save a downloaded file to the desired location. Let's see how we can do that. The code snippet below will download and save a file from a website. ChromeOptions() has been initialized here. In AddUserProfilePreference, download.default directory, enter the path of the directory where you want to save the downloaded file. using OpenQA . Selenium ; using OpenQA . Selenium . Chrome ; using System ; using System . Threading ; using System . Windows . Forms ; using WebDriverManager ; using WebDriverManager . DriverConfigs . Impl ; using WebDriverManager . Helpers ; private void DownloadButton_Click ( object sender , EventArgs e ) { // Download the same ver...