【问题标题】:Selenium Remote Standalone Server - Driver unknownSelenium 远程独立服务器 - 驱动程序未知
【发布时间】:2020-07-18 20:25:40
【问题描述】:

我在使用 Firefox、Gecko 和 Selenium Standalone Server Jar 文件版本 4.0.0-alpha-1 运行的 Google Cloud Platform 中有一个 docker 容器。有了这个我有这个图像:

FROM ubuntu:bionic
LABEL maintainer="Matheus Carvalho Gomes Moreira, matheus@hrestart.com.br"
EXPOSE 4444
ENV PORT 4444
ENV VERSION "V6.1"

# Systems update
RUN apt-get update && apt-get install -y \
    python3 python3-pip \
    fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
    libnspr4 libnss3 lsb-release xdg-utils libxss1 libdbus-glib-1-2 \
    curl unzip wget \
    xvfb

# install java and selenium-server-standalone

RUN apt-get install openjdk-8-jdk -y
RUN wget -O /home/selenium-standalone.jar http://selenium-release.storage.googleapis.com/4.0/selenium-server-standalone-4.0.0-alpha-1.jar

# setup Java Environment

RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN export PATH=$PATH:$JAVA_HOME/bin

# install geckodriver and firefox

RUN GECKODRIVER_VERSION=`curl https://github.com/mozilla/geckodriver/releases/latest | grep -Po 'v[0-9]+.[0-9]+.[0-9]+'` && \
    wget https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz && \
    tar -zxf geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/local/bin && \
    chmod +x /usr/local/bin/geckodriver && \
    rm geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz

RUN FIREFOX_SETUP=firefox-setup.tar.bz2 && \
    apt-get purge firefox && \
    wget -O $FIREFOX_SETUP "https://download.mozilla.org/?product=firefox-latest&os=linux64" && \
    tar xjf $FIREFOX_SETUP -C /opt/ && \
    ln -s /opt/firefox/firefox /usr/bin/firefox && \
    rm $FIREFOX_SETUP

CMD tail -f /dev/null
CMD DISPLAY=:1 xvfb-run java -jar /home/selenium-standalone.jar

还有我的客户:

FirefoxOptions options = new FirefoxOptions();
driver = new RemoteWebDriver(new URL("${URL_TO_CONTAINER}"), options);

但是当我尝试创建访问端点的远程驱动程序的实例时,它给出了这个错误:

Unable to create new service: GeckoDriverService
Build info: version: '4.0.0-alpha-1', revision: 'd1d3728cae', time: '2019-04-24T16:15:24'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0', java.version: '1.8.0_242'
Driver info: driver.version: unknown

我搜索了它,可能是因为它找不到为初始化服务而安装的 Firefox 和 Gecko。有人有什么想法吗?

【问题讨论】:

    标签: java docker selenium unix google-cloud-platform


    【解决方案1】:

    我没有使用过 geckodrivers,但我发现了这个 project,您可以将其用作测试,然后找出如何设置驱动程序的代码以及下一个 article 如何设置在 docker 容器中使用 selenium 的应用程序。

    【讨论】:

    • 感谢您的回复。我已经看过上面的链接,但没有一个对我有帮助。
    • 我希望项目信息对您有所帮助,因为使用了大多数主要组件,或者您为什么不认为它不适合您...一种选择是您尝试请求在问题选项卡下支持此项目,以便专家可以提供有关此问题的调查结果
    猜你喜欢
    • 1970-01-01
    • 2012-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-16
    • 1970-01-01
    • 2017-09-11
    • 1970-01-01
    相关资源
    最近更新 更多