Selenium cannot find file running in separate container

倖福魔咒の 提交于 2019-12-24 09:39:12

问题


I have 4 containers running in the same Docker network

  • mongodb
  • our api server
  • a selenium server
  • our tests themselves

I get this error from our test container:

 WebDriverError: File not found: /root/cdt-tests/csv-data/IT-DE-Jasper.csv

However, from my test logs, this file totally exists...in the test container.

The problem, I think, is that the selenium server is not looking at the same filesystem as our test container, because they are running in different containers.

What is the best way to solve this problem?

a. Should I try to run them in the same container?

b. Can I somehow get them to share the same filesystem?

c. ?


回答1:


Just because you are sharing the network doesn't mean you are sharing the volumes, see how to do that In Docker, how can I share files between containers and then save them to an image? as @alex-blex suggested




回答2:


You may be able to connect the containers using a user-defined network, as explained on Docker's site

If you've already done that, it might be an issue with the path to the file you're using in your test. Perhaps it wants an absolute path, because the containers are considered different entities on the Docker network



来源:https://stackoverflow.com/questions/44146561/selenium-cannot-find-file-running-in-separate-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!