0

I'm downloading one file using selenium now it has been save in path C:Downloads but I want that to save in separate path where I like to save.

Using selenium can I move that desktop file from one location to another where I want or else can I set a path in Eclipse itself where to download the file while executing the script.

Atul KS
  • 908
  • 11
  • 21

1 Answers1

0

If you are using Java 7 or newer version then you can make use of Files.move(from, to, CopyOption... options)

Files.move(Paths.get("C:\\Downloads\\Kumar.txt"), Paths.get("Full new file path location"));

or else using Selenium (Options) :

protected static WebDriver driver;

@Test
public void testSO() throws InterruptedException {
  ChromeOptions options =  new ChromeOptions();
  options.addArguments("download.default_directory = C:/Downloads");
  driver = new ChromeDriver(options);
}

You can set the value of download.default_directory to your desired location.

cruisepandey
  • 28,520
  • 6
  • 20
  • 38