Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在无头chrome Docker中获取运行selenium的空页_Docker_Selenium_Selenium Webdriver_Headless - Fatal编程技术网

在无头chrome Docker中获取运行selenium的空页

在无头chrome Docker中获取运行selenium的空页,docker,selenium,selenium-webdriver,headless,Docker,Selenium,Selenium Webdriver,Headless,我正在一个基于Oracle Linux的Docker中运行一个无头chrome测试用例 我请求的页面应该被重定向到带有username-password字段的身份验证页面,但我在docker server()中得到的是空白页面。这在我的macbook上运行得很好 这是我尝试从docker内部使用chrome浏览器直接运行相同程序时的输出 bash-4.2# google-chrome --headless --no-sandbox --dump-dom --ignore-ssl-errors

我正在一个基于Oracle Linux的Docker中运行一个无头chrome测试用例

我请求的页面应该被重定向到带有username-password字段的身份验证页面,但我在docker server()中得到的是空白页面。这在我的macbook上运行得很好

这是我尝试从docker内部使用chrome浏览器直接运行相同程序时的输出

bash-4.2# google-chrome --headless --no-sandbox  --dump-dom --ignore-ssl-errors --ignore-certificate-errors  --ssl-protocol=TLSv1 --allow-running-insecure-content --allow-insecure-localhost  https://example.com/
[0108/134257.881648:错误:bus.cc(393)]连接到总线失败:连接到套接字失败/run/dbus/system_bus_socket:没有这样的文件或目录

**[0108/134327.972921:错误:证书颁发者来源aia.cc(104)]AIRequest::OnFetchCompleted获得错误-3

** 操作系统详细信息:Linux 7e3f36f795d9 4.1.12-124.45.6.el7uek.x86#u 64#2 SMP Wed Nov 25 06:46:51 PST 2020 x86_64 x86_64 GNU/Linux

即使我在linux docker中运行,传递的用户代理是“-user agent=Mozilla/5.0(Macintosh;Intel Mac OS X 10_15_2)AppleWebKit/537.36(KHTML,类似Gecko)Chrome/87.0.4280.88 Safari/537.36”。我应该使用Linux用户代理吗

Chrome二进制和Chrome webdriver版本:87.0.4280.88 这可能是什么原因,我被困在这两天了。 提前谢谢

Docker文件如下所示

        FROM base_image
    ARG USER=usr
    RUN yum -y install wget \
    && wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm \
    && yum -y install libappindicator-gtk3-12.10.0-13.el7.x86_64  \
    && yum -y install libXScrnSaver-1.2.2-6.1.el7.x86_64  \
    && yum -y install liberation-fonts-1.07.2-16.el7.noarch \
    && yum -y install liberation-narrow-fonts-1.07.2-16.el7.noarch alsa-lib-1.1.8-1.el7.i686 xdg-utils alsa-lib-devel\
    && wget     http://mirror.centos.org/centos/7/os/x86_64/Packages/vulkan-filesystem-1.1.97.0-1.el7.noarch.rpm \
    && wget http://mirror.centos.org/centos/7/os/x86_64/Packages/vulkan-1.1.97.0-1.el7.x86_64.rpm \
    && rpm -ivh vulkan-filesystem-1.1.97.0-1.el7.noarch.rpm \
    && rpm -ivh vulkan-1.1.97.0-1.el7.x86_64.rpm \
    && rpm -ivh google-chrome-stable_current_x86_64.rpm \
    && yum clean all
    RUN rm -rf /var/cache/yum;
    EXPOSE 8080

所以docker形象中的问题是肯定的。在安装过程中发生了很多事情,我看不到最明显的事情是安装真正的
chromedriver

# install chromedriver
RUN apt-get install -yqq unzip
RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

有关自定义docker映像的更多信息,您可以在此处进行检查。此外,我建议使用Prebuild,它每次对我都非常有效。

您没有在原始帖子中添加最重要的信息,即container.updated docker文件。感谢您的回复,但我手动处理了chromedriver,并将其位置与System.setProperty(“webdriver.chrome.driver”)类似,webdriverPath);这似乎是个问题。邮件页面会加载,但只要有直接流到外部系统的身份验证,它就不会返回并给出此错误**[0108/134327.972921:error:cert_issuer_source_aia.cc(104)]airequest::OnFetchCompleted get error-3@VijayakumarKb这与上面的描述完全不同。但是,您提到了证书颁发,应该禁用它。下面是我尝试过的所有google chrome的解释--无头--无沙箱'--禁用web安全'--禁用web安全--忽略证书错误--忽略ssl错误--转储dom,但页面将重定向到具有httpstatus 302的站点,然后加载具有用户名passowrd的页面。但我没有看到重定向页面,只有空白页面。但是如果我直接加载重定向页面,它会加载,但是从主主页它不会加载如果我从docker主机上执行curl-vk www.example.com,它会返回302,redirecturl@VijayakumarKb好的,没关系。302重定向的结果没有问题。这里有什么问题?可能您想通过重定向调用url,例如
curl-L