I run my tests in docker by using webdrivermanager. I need to upload some files into the running docker. So, I will be able to use those files in my tests.
I initalised my tests with the code block below:
WebDriverManager wdm = WebDriverManager.chromedriver().browserInDocker()
.enableVnc().enableRecording();
I get 3 docker image:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
202ddc0ff02b selenoid/video-recorder:7.1 "/entrypoint.sh" 2 minutes ago Up 2 minutes serene_lumiere
756cd8a49770 bonigarcia/novnc:1.1.0 "bash -c '/root/noVN…" 2 minutes ago Up 2 minutes 0.0.0.0:65228->6080/tcp stoic_bhaskara
7e7a956fb2c2 selenoid/vnc:chrome_108.0 "/entrypoint.sh" 2 minutes ago Up 2 minutes 0.0.0.0:65217->4444/tcp, 0.0.0.0:65218->5900/tcp hopeful_brahmagupta
After that, I use dockerVolumes()
for being able to copy the file from my local to docker.
I read related part of the documentation. However, it seems I keep using it wrong.
wdm.dockerVolumes("/home/GitHub/e2e-test/doc.pdf:/home");
/home/GitHub/e2e-test/doc.pdf
is directory on local.
/home
is directory in the docker image where I need to have the file at.
When I noticed dockerVolumes()
method, I like it. Because, otherwise, I need to implement more steps to make this action like running command line in the tests, read the containers id and copy the file...
However, it didn’t work. How can I use it? How copy a file from my local to docker image by using webdrivermanager?
CodePudding user response:
The syntax of this methods is as follows:
dockerVolumes("/local/path:/container/path")
In your code, perhaps it is something like the following (ensure the paths, in any case):
dockerVolumes("/home/GitHub/e2e-test:/home/selenium")