我正在尝试运行 Selenium 的 Docker 镜像,从这个镜像中运行以下命令:
docker run -d -p 4444:4444 --shm-size 2g selenium/standalone-chrome:4.0.0-beta-3-prerelease-20210329
,该镜像来自于https://hub.docker.com/r/selenium/standalone-chrome
。当我运行此命令时,我可以在http://localhost:4444/上看到 Selenium。我需要允许 Selenium 访问我的 localhost URL。我查阅了文档,但没有找到任何相关内容。我正在使用 Selenium 触发 Codeception 测试,我在这里看到提到了 Selenium 的 Docker 容器(https://codeception.com/docs/modules/WebDriver#headless-selenium-in-docker),但是该命令实际上启动了 Selenium,但我不知道如何访问它。这是命令和日志: docker run --net=host selenium/standalone-chrome
。2021-03-30 10:33:15,835 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2021-03-30 10:33:15,839 INFO supervisord started with pid 9
2021-03-30 10:33:16,848 INFO spawned: 'xvfb' with pid 11
2021-03-30 10:33:16,854 INFO spawned: 'selenium-standalone' with pid 12
10:33:17.160 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2021-03-30 10:33:17,161 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2021-03-30 10:33:17,162 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
10:33:17.261 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2021-03-30 10:33:17.318:INFO::main: Logging initialized @435ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:33:17.577 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
10:33:17.680 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
希望能得到任何有关使这两种方式之一正常工作的帮助。