Is there a way to change the filename of the file that's being downloaded using Selenium in Python

585 views
Skip to first unread message

amulyan...@gmail.com

unread,
Sep 3, 2014, 4:55:06 PM9/3/14
to seleniu...@googlegroups.com

I'm downloading more than a thousand files from a website using Python. I was able to download the files but they get saved like new.txt.gz, new(1).txt.gz and so on. I was wondering if there's a way to name these files before they're saved. I've tried searching for a solution, but most of them say its not possible. However, the answers date back to 2009-2011. I want to know if there's a way to do it now.

PS - Please do not suggest urllib or mechanize or something of that kind. I'd like to do this only with Selenium because the others have certain limitations in my case.

Krishnan Mahadevan

unread,
Sep 5, 2014, 9:11:32 PM9/5/14
to Selenium Users

Am guessing your test knows where the files are being downloaded. So why not use python to rename the downloaded file into something else. Wouldn't that work ?

On Sep 4, 2014 12:19 PM, <amulyan...@gmail.com> wrote:

I'm downloading more than a thousand files from a website using Python. I was able to download the files but they get saved like new.txt.gz, new(1).txt.gz and so on. I was wondering if there's a way to name these files before they're saved. I've tried searching for a solution, but most of them say its not possible. However, the answers date back to 2009-2011. I want to know if there's a way to do it now.

PS - Please do not suggest urllib or mechanize or something of that kind. I'd like to do this only with Selenium because the others have certain limitations in my case.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a7a1da20-793e-4f5a-a43a-c3209954290e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages