How to point RemoteWebDriver to one of the multiple standalone docker selenium standalone chrome browsers?

僤鯓⒐⒋嵵緔 提交于 2020-08-10 18:10:18

问题


I've requirement to run test cases on separate chrome browsers running inside docker container.

I've install chrome docker containers as below

docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.8.1-francium

docker run -d -p 4444:4444 -p 5901:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.8.1-francium
  • I have scripts which does unique tasks like analytics testing, performance testing etc so I can't use Grid approach here.

  • This is what I do in case of single chrome browser but I need to point to a particular docker container image

    WebDriver driver = new RemoteWebDriver( new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.firefox());


回答1:


Got it working with help of comment from @Flore B.

docker run -d -p 5902:4444 -p 5903:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.8.1-francium

RemoteWebDriver url

http://0.0.0.0:5902/wd/hub


来源:https://stackoverflow.com/questions/48527048/how-to-point-remotewebdriver-to-one-of-the-multiple-standalone-docker-selenium-s

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