TilBlechschmidt/ParallelSeleniumTest

How to download a file?

makorne opened this issue ยท 3 comments

Hi!

I try to test click button to download pdf.

Set as written on the thirtyfour page:

caps.add_chrome_arg("/tmp")?;
caps.add_chrome_arg("download.prompt_for_download=false")?;

Then click on the button over local webgrid in docker...

All tests finished. 1 / 1 succeeded.

No errors but no downloaded pdf too.

Maybe I need to set some additional webgrid options?
Maybe the CapabilityUnhandledPromptBehavior::AcceptAndNotify and something else?

Since (at least in case of WebGrid) each Browser runs inside its own Docker/K8s container, the downloaded files are being stored within said container. The same holds true for the Selenium Grid, only that the nodes/pods/containers running the browsers are semi-persistent.

If you would like to extract the files you'd have to mount a local directory into the Docker/K8s container and set its path as the Chrome arg.

I tried to add /tmp:/tmp :

   orchestrator:
    image: ${REPOSITORY:-webgrid}/core:${IMAGE_TAG:-v0.5.1-beta}
    platform: linux/amd64
    container_name: webgrid-orchestrator
    command: orchestrator --slot-count 5 example-orchestrator docker --images "${REPOSITORY:-webgrid}/node-firefox:${IMAGE_TAG:-v0.5.1-beta}=firefox::68.7.0esr,${REPOSITORY:-webgrid}/node-chrome:${IMAGE_TAG:-v0.5.1-beta}=chrome::81.0.4044.122" --log debug,hyper=warn,warp=warn,sqlx=warn,tower=warn,h2=warn --trace-endpoint http://webgrid-otelcol:4317 ${ORCHESTRATOR_FLAGS:-}
    depends_on:
      - redis
    volumes:
      - /tmp:/tmp

And restarted webgrid.
But the file still does not download.

Yeah I'm afraid that is not going to work. The orchestrator is just a component that creates the containers that then contain the browsers. With the Kubernetes orchestrator you could modify the Pod YAML, however, that is currently not possible with the Docker one.

Since the issue is related to WebGrid and not this test tool, I've opened a corresponding issue over in that repository (see above). If you have any further questions please write them there ๐Ÿ™‚