docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

[🚀 Feature]: Allows to configure volume mappings for dynamically generated containers of Dynamic Grid

Open chenqinggang001 opened this issue 3 years ago • 6 comments

Feature and motivation

I want volume mapping to upload files and deliver camera video streams

Usage example

[docker]

configs = [
    "selenium/standalone-firefox:4.3.0-20220726", "{\"browserName\": \"firefox\",\"volumes\":[\"/data:/data\"]}",
]
options.add_argument('--allow-file-access-from-files')
options.add_argument('--use-fake-ui-for-media-stream')
options.add_argument('--use-fake-device-for-media-stream')
options.add_argument('--use-file-for-fake-video-capture=/data/test.y4m')
options.add_argument('--use-file-for-fake-audio-capture=/data/test.wav')

chenqinggang001 avatar Jul 31 '22 14:07 chenqinggang001

We won't take the path of having volume mappings but probably we should add a command to download a file in the Node for these type of things. However, this needs to bring more interest from the community and probably that someone wants to work on it.

diemol avatar Aug 01 '22 08:08 diemol

selenium/node-chrome:latest Is it suitable for dynamic grids?

chenqinggang001 avatar Sep 05 '22 01:09 chenqinggang001

This would be very useful. In my case, mapping chrome download folder to windows folder:

config.toml [docker] configs = [ "selenium/standalone-chrome:latest", "{"browserName": "chrome"}" ] devices = [ 'c:/seleniumData:/mnt/profiles' ]

var downloadDir = "/mnt/profiles"; chrome_options.AddUserProfilePreference("download.default_directory", downloadDir);

Thank you.

luidiva avatar Sep 13 '22 14:09 luidiva

good thankyou

xiaotuzididi avatar Dec 31 '22 08:12 xiaotuzididi

Can this be achieved via --docker-devices ?

https://github.com/SeleniumHQ/selenium/blob/184a83575e0f8985297e7d2dee49e27f14b14fe0/java/src/org/openqa/selenium/grid/node/docker/DockerFlags.java#LL73C1-L73C1

damencho avatar May 18 '23 20:05 damencho

That is meant to mount kvm but might work. I have not tried it.

diemol avatar May 19 '23 08:05 diemol

Hey all, Looking for capability to upload a file temporarily and use it with selenium automation. Can this issue be prioritised?

Some Background - Zalenium has this capability which allows user to upload a file to a mount temporarily and use it with selenium. As we are thinking of moving to docker-grid4, we are facing this issue of not having capability to upload file in docker.

rajat-garg-del avatar Apr 09 '24 05:04 rajat-garg-del

If you need to upload a file, you can already do it with https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/#uploads

diemol avatar Apr 09 '24 08:04 diemol

The Image we are trying to upload is in aws s3 and quite large. This method, won't suffice for that. We will be having a remote docker server and test would be run through jenkins. So, we are looking for an option to upload the file first to docker server and then upload. This way it would work.

rajat-garg-del avatar Apr 10 '24 10:04 rajat-garg-del

Is the file always the same one? If so, why don't you build your own docker image based on the official ones and add the file to it?

diemol avatar Apr 10 '24 10:04 diemol

No. The file would be different every other time. It's dynamic upgrade images, which we would upload. Each time a new one.

rajat-garg-del avatar Apr 10 '24 12:04 rajat-garg-del

In any case, you are uploading the file to the website you are testing. If the file is enormous, you are still transferring it over the network. Is that the only way to test your feature? I cannot imagine how long those tests take.

diemol avatar Apr 10 '24 13:04 diemol

Yes. Since, the test is about uploading image and upgrading the system via UI. We have to follow these steps to check all the UI elements and steps. It does take sometime but that's not an issue.

rajat-garg-del avatar Apr 11 '24 10:04 rajat-garg-del

@rajat-garg-del, can you read through this example to see if it helps? https://github.com/SeleniumHQ/docker-selenium/issues/2143#issuecomment-2051282667

VietND96 avatar Apr 12 '24 08:04 VietND96