-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
selenium/standalone-chrome-debug can't download files #548
Comments
Hello, I've been trying to accomplish the same thing using almost the same exact Docker setup. My question is did you have to do anything special in the first place to download the file? Basically what I'm running into is that the OS specific download prompt comes up when the download is initiated, and Selenium is, of course, unable to control this OS prompt. I'm really curious how it was working for you in the past. |
Hi @piscisferro, There was a bug introduced in If not, please help us by providing enough information (docker commands, logs, test script, etc...) for us to reproduce the problem and find a way to fix it. |
Hi For the download I define the folder location and the option to download the file directly to that folder using the ChromeOptions:
When clicking on the download button, the browser should download the file directly to the downloads folder in /temp. For this to be "seen" by the anapsix/alpine-java container (which is the container that is executing the script) the two must be connected, I connected them creating a volume in /temp/downloads in the docker-compose file, and as a side effect I have connected it too to my local (so I can see the folder to check manually if required) The test-script isn't complex, just click on the download button wait a few seconds and then do a linux bash command through java to check that the file downloaded correctly.
The bash sentence don't return nothing because nothing is downloaded. If I enter to the container (selenium/standalone-chrome) using for example: In the /temp folder, every time that the download button is clicked it creates a temp file (probably the temporal file that the browser creates when download) but it never "finish" nor get converted to the proper pdf file. About the env bug, I'm only using env variables to set the URL i tried with 3.5.3-boron with no luck, I tested it to in 3.6.0, don't work. --- Edited: Sorry It was late and I was in the mobile phone when I wrote this yesterday, edited to clarify it and provide more information |
Edited the last post to clarify it and provide more information |
Sorry for replying so late. I was trying this, and I got confused. Before trying something else, can you please check via VNC the container and see what is happening when you click on the download button? You should be able to understand there why the download does not happen. It also seems that the behaviour in Chrome changed, see: Can you please also share your docker-compose file, to see how the folder is mounted? Maybe you can share a link (with a button to download a PDF) where I can reproduce the issue. |
I have the same problem and it's related with file permissions. When docker-compose created a volume it's assign with the root:root permission and the seluser can't write on file |
@piscisferro, @wlaoh, @renanwilliam I would really appreciate if someone can provide the docker run commands or the docker-compose file used to start the containers. Also a complete test script with a reproducible case, otherwise it is kind of hard to help to find a solution. |
Hi @diemol, To reproduce the error you need to be on a Linux machine, ok?
|
I think it's more a docker-compose issue but is not only responsible, If selenium docker image runs with root user this behavior will not occurs. I already have tried:
|
Hi @piscisferro, @renanwilliam Sorry for the delay. I tried to reproduce the issue, and for that, I started a standalone Chrome debug container with the following command:
and then I executed this test I was able to download the file and verify that it was downloaded in the mounted volume. If you are still having the issue, could you also please provide (like I just did), a test script that helps us reproduce the issue? A docker command is useful as well (or docker-compose). |
@renanwilliam docker and docker-compose usually just pass through the filesystem permissions. With your test repository if you do this instead it should work:
|
@renanwilliam I ran the script above in OSX and I did not have any permission issues. Again, if there is an issue with one of your tests, please help us by providing a script that we can run to reproduce the issue and fix it, because with the current information, we cannot really reproduce it. |
First I want to remember that this work fine with 3.4.0-chromium version. Last version I tried was a week ago (3.7.0) and still not working. Simplifying, these are the test scripts I'm using. docker-compose (I'm using an image created by me based on anapsix/alpine-java to run the tests):
Selenium Test:
As an additional info: I have the same issue using the selenium/standalone-firefox-debug container so it's not only for the chrome one I hope this help. |
Hi @piscisferro, I updated the script I am using to reproduce the issue based on your input. I created this docker-compose file similar to yours, and the I executed the test with this command:
The bottomline is that the test is passing, the image is being downloaded. Could you please have a look at the scripts I modified and perhaps compare them with yours? Please note that I am using the latest release of the image |
Ok, after testing further and checking @renanwilliam comment:
Just that:
Now the thing is, why this restricted permission affect from 3.4.0-chromium onwards but is not affected in 3.4.0-chromium? What is the correct functionality? the 3.4.0-chromium behavior or the 3.7.1-beryllium behavior? |
Ah ok, so in the end this was more related to folder permissions, which is more clear when running the images in Ubuntu (this does not affect usually OSX nor Windows). The images were changed to use the Sorry if this caused any inconvenience, but just changing the folder permissions fixes it, as @ralfthewise mentions. |
@piscisferro, I'll go ahead and close this issue since we found the root cause and a solution to it, (as mentioned in the comment above). If there are still any related problems, please feel free to reopen. |
Meta -
Image(s): selenium/standalone-chrome-debug
Docker-Selenium Image Version(s): From 3.4.0-einsteinium to 3.5.2
OS: Ubuntu 16.04
Description
I will explain the setup: I have 2 docker containers, one created by me based in anapsix/alpine-java and this chrome-standalone-debug container connected to a docker network with more containers. With docker-compose I create a volume for both chrome and java container to allow share files between them and my local.
One of the test should download a few files, store it in the specified volume folder and then check if that file exist and is downloaded.
It worked fine until a few days ago, it stopped to work (probably because an update, I was using latest as a tag) and the file didn't download anymore. I tested the code in all versions from 3.4.0-einstenium to 3.5.2 and it didn't work in any of them.
Today I tested it with 3.4.0-chromium version and it worked fine. As an additional info, I ran the code with chromedrive in my local and it worked fine too.
Expected Behavior -
When downloading a file the file downloads successfully.
Actual Behavior -
When downloading a file, it doesn't download anything.
The text was updated successfully, but these errors were encountered: