Discussion:
[selenium-users] Is it possible to download files to the test machine during a grid test?
Tony Belfiore
2016-08-24 12:51:07 UTC
Permalink
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files (from
my test/build machine to the node).


I was wondering if it was possible to *download* files from my Grid node to
my test machine - similar to LocalFileDetector for uploads. I would really
like my test logic/machine to verify the file that was downloaded.


What is the recommended approach for such scenarios?

Any advice would be greatly appreciated.


Thanks.


--Tony
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
⇜Krishnan Mahadevan⇝
2016-08-24 13:19:02 UTC
Permalink
Tony,
No there is no such thing that is available in the Grid infrastructure that
lets you do this.
But Mark collins had written up a very elaborate article on downloading
with selenium.

Perhaps you can take a look at it :
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening
or in love with someone else!"
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid node
to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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
To view this discussion on the web visit https://groups.google.com/d/
msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%
40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLkZfE9A986e_6HNG7EueiEYihKCMvEGegK8tVY1DuswaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Tony Belfiore
2016-08-24 14:51:36 UTC
Permalink
I did read his great article.

However, it is critical we are able to download a file and validate its
contents.

I did see his "FileDownloader" class, but I wasn't sure if that would help
me as (a) we are working in .NET, and (b) it wasn't clear to me that
FileDownloader would actually put the downloaded file on the test machine
like LocalFileDetector.

Is there a FileDownloader-like solution out there somewhere to try for
.NET?
Or am I stuck with writing my own custom solution?

Mark makes great points about avoiding downloads, but I'm sure there are a
lot of people in the same boat as myself, and I'm surprised something
better doesn't exist.
Post by ⇜Krishnan Mahadevan⇝
Tony,
No there is no such thing that is available in the Grid infrastructure
that lets you do this.
But Mark collins had written up a very elaborate article on downloading
with selenium.
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening
or in love with someone else!"
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid node
to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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
<javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/cf31f2d3-dd7f-447b-9a49-f46021911b5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
⇜Krishnan Mahadevan⇝
2016-08-24 14:55:10 UTC
Permalink
Tony,

I am not aware of any .NET solutions [ I am a Java guy too ]. So you may
have to handcraft a similar one for your usage.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening
or in love with someone else!"
Post by Tony Belfiore
I did read his great article.
However, it is critical we are able to download a file and validate its
contents.
I did see his "FileDownloader" class, but I wasn't sure if that would help
me as (a) we are working in .NET, and (b) it wasn't clear to me that
FileDownloader would actually put the downloaded file on the test machine
like LocalFileDetector.
Is there a FileDownloader-like solution out there somewhere to try for
.NET?
Or am I stuck with writing my own custom solution?
Mark makes great points about avoiding downloads, but I'm sure there are a
lot of people in the same boat as myself, and I'm surprised something
better doesn't exist.
Post by ⇜Krishnan Mahadevan⇝
Tony,
No there is no such thing that is available in the Grid infrastructure
that lets you do this.
But Mark collins had written up a very elaborate article on downloading
with selenium.
Perhaps you can take a look at it : http://ardesco.lazerycode.co
m/index.php/2012/07/how-to-download-files-with-selenium-and-
why-you-shouldnt/
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive,
fattening or in love with someone else!"
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid
node to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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
To view this discussion on the web visit https://groups.google.com/d/ms
gid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40go
oglegroups.com
<https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
To view this discussion on the web visit https://groups.google.com/d/
msgid/selenium-users/cf31f2d3-dd7f-447b-9a49-f46021911b5b%
40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/cf31f2d3-dd7f-447b-9a49-f46021911b5b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLk2BNP1rdw1p8ApF_5etTqNb6bEibaA3scAAhQjO8oSnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
David
2016-08-24 17:05:18 UTC
Permalink
Mark's solution should (in theory) save the file to the test machine that's
executing the test code, not the browser node running the Selenium commands.

I don't know of any public .NET implementations for Mark's method, but
while it takes some work to build, it's fairly trivial to do. Just craft a
method to use HTTP request/response classes for the respective language
platform, pass in a "session" cookie if needed, save the response as bytes
to file. Would be nice if someone did share their implementation to the
public.

I did find Mark's implementation a bit bloated just to use as a library for
file downloads as there's more nice abstraction than needed. I just needed
a simple method/class to download a file. So here's an alternative
implementation that's more basic and easier to port for .NET I'd think:
https://gist.github.com/daluu/4411221

I also made a variant in PHP, so that shows you it's a fairly trivial task
to do: https://gist.github.com/daluu/3433180. Did PHP first when we were
using Selenium RC with it, and did the Java one when we migrated to
WebDriver with Java.
Post by Tony Belfiore
I did read his great article.
However, it is critical we are able to download a file and validate its
contents.
I did see his "FileDownloader" class, but I wasn't sure if that would help
me as (a) we are working in .NET, and (b) it wasn't clear to me that
FileDownloader would actually put the downloaded file on the test machine
like LocalFileDetector.
Is there a FileDownloader-like solution out there somewhere to try for
.NET?
Or am I stuck with writing my own custom solution?
Mark makes great points about avoiding downloads, but I'm sure there are a
lot of people in the same boat as myself, and I'm surprised something
better doesn't exist.
Post by ⇜Krishnan Mahadevan⇝
Tony,
No there is no such thing that is available in the Grid infrastructure
that lets you do this.
But Mark collins had written up a very elaborate article on downloading
with selenium.
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive,
fattening or in love with someone else!"
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid
node to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e4babe9b-2672-4f91-9d23-491023252b39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anand
2016-08-25 18:01:43 UTC
Permalink
you can point the download path of nodes to the ftp server

Chome Preference/Options in webdriver are having option to set the default
download path for the node which should be ftp server path which hub and
nodes can access
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid node
to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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
To view this discussion on the web visit https://groups.google.com/d/
msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%
40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANNV5RdLLwdey8W89UL9g4tN5K2HJKqOuHs7WrpCJzvyN8_N6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
David
2016-08-26 19:07:27 UTC
Permalink
Thanks for that tip Anand. Is it only for Chrome? What about FF, Safari, IE?
Post by Anand
you can point the download path of nodes to the ftp server
Chome Preference/Options in webdriver are having option to set the
default download path for the node which should be ftp server path which
hub and nodes can access
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid node
to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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
<javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/59708175-d796-4cec-82be-6431fdc13646%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/19b2e148-6866-4421-a6ee-4125ba5f8bd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tony Belfiore
2016-09-09 12:24:19 UTC
Permalink
Thanks for the comments everyone. I'm still looking into this issue.

Our current strategy is to have the grid Nodes download files to a Shared
Folder on the network. This same folder is also accessible by the test
machine, so the test logic can retrieve the downloaded file and verify its
contents.

A few issues though:

* We'd like each individual test to dump its downloaded file into a unique
sub-directory in the Shared Folder. This way tests won't interfere with
each other if they use the same file names. Ideally we would use the
SessionId from the RemoteWebDriver as the subdirectory name. However, this
won't work because the "download directory" setting in the options (e.g.
ChromeOptions, FirefoxProfile) must be set *before* we instantiate the
RemoteWebDriver and get the SessionId. Anyone have an idea how to solve
this riddle (other than creating my own unique testId)?

* I just realized that IE does not support a "download directory" in the
InternetExplorerOptions class, so there is no programmatic way to set the
sub-directory under the Shared Folder. So, I guess IE is a dead end for
anyone trying to do what we are doing?

--Tony
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid node
to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ee0b5dc8-d2cf-451a-8f55-55e7a9b7f5da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David
2016-09-09 22:23:26 UTC
Permalink
If you set download directory, I think you can't set the download file
name, it's auto-generated/default what the browser uses? I don't know as
I've not use that feature myself. If you can set the filename on download,
you can just make that unique for each browser/node and that would solve
your problem - similar uniqueness separation as unique subdirectories.

But I would think for your specific case, you're better off using the Mark
Collins approach to achieve cross browser testing support and be able to
use unique subdirectories, etc. You have full control with Mark's approach.
Why use the native browser feature when it's restrictive? You're not
testing the browser functionality/compatibility specifically but rather
your app/site with respect to the download file so you shouldn't be
required to test the browser's native file download.
Post by Tony Belfiore
Thanks for the comments everyone. I'm still looking into this issue.
Our current strategy is to have the grid Nodes download files to a Shared
Folder on the network. This same folder is also accessible by the test
machine, so the test logic can retrieve the downloaded file and verify its
contents.
* We'd like each individual test to dump its downloaded file into a unique
sub-directory in the Shared Folder. This way tests won't interfere with
each other if they use the same file names. Ideally we would use the
SessionId from the RemoteWebDriver as the subdirectory name. However, this
won't work because the "download directory" setting in the options (e.g.
ChromeOptions, FirefoxProfile) must be set *before* we instantiate the
RemoteWebDriver and get the SessionId. Anyone have an idea how to solve
this riddle (other than creating my own unique testId)?
* I just realized that IE does not support a "download directory" in the
InternetExplorerOptions class, so there is no programmatic way to set the
sub-directory under the Shared Folder. So, I guess IE is a dead end for
anyone trying to do what we are doing?
--Tony
Post by Tony Belfiore
I have a Selenium Grid with nodes set up for my automated testing (on
windows machines). I have successfully used the LocalFileDetector approach
when I have tests (.NET Selenium v2.53.1) that need to*upload* files
(from my test/build machine to the node).
I was wondering if it was possible to *download* files from my Grid node
to my test machine - similar to LocalFileDetector for uploads. I would
really like my test logic/machine to verify the file that was downloaded.
What is the recommended approach for such scenarios?
Any advice would be greatly appreciated.
Thanks.
--Tony
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4a0da02f-9396-4d1c-9b33-39d3080c83ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...