How to download a file to a specific folder and then delete the file .
I have tried all the possibilities mentioned in the blog , also tried the selenium code but it didnt work and the file was downloaded to download folder itself .
Hello @nacchicool2007
you can delete the file by giving the extension of the file you downloaded as follows.
You can add this to the test case or it can be defined as a separate keyword.
2.) Add a new desired capability, and set Name = prefs, Type = Dictionary, then click on the ellipses in the Value column:
3.) In the Dictionary Property Builder, add a row and set Name = download.default_directory, Type = String, and set Value to the location you would like files to go to:
Now, any files downloaded by your browser will go to that directory. Then, you can follow @emine’s recommendation on how to delete that file when you’re done.
Hi,
Currently using chrome desired capabilities am downloading all the files into one particular directory but my requirement is like all the CSV downloading files has to be in one folder and PDF should be in another folder is it possible?
No, that’s not possible. Chrome has only one download directory, and the same is true for chromedriver. What you could do though is set a default directory as shown above, then just write some code to copy certain file types to whichever directories you prefer.
Hi @Brandon_Hein In my test case i’m calling batch file but it’s throwing an error like(Method definition not expected here. Please define the method at an appropriate place or perhaps try using a block/Closure instead. at line: 74 column: 2. File: script1593420794488.groovy @ line 74, column 2.),Can please help me how i can resolve.
Four our project, we are running the scripts in Azure Docker, which i don’t know the defaulted download file location is.
So i am thinking:
User RunConfiguration to get the project file location from docker
Then put the download file location same as the project file location.
This way, i don’t have the capability to set the file default location from Project Settings. Can someone help give some advice how to get the download file location from Docker?