使用Xvfb运行RobotFramework Selenium测试

时间:2017-07-11 16:53:47

标签: python selenium robotframework xvfb

按照XvfbRobot指定的用法,我遇到了一些问题。我正试图通过烧瓶进行机器人测试,这似乎正在起作用,但我仍然坚持,“没有浏览器打开,”虽然虚拟显示似乎开始很好。

Dockerfile

FROM alpine:3.4

# Update source repositories
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.4/main" >> /etc/apk/repositories
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.4/community" >> /etc/apk/repositories

ADD . /code
WORKDIR /code

# Install geckodriver:
RUN export BASE_URL=https://github.com/mozilla/geckodriver/releases/download
RUN export VERSION=$(curl -sL https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep tag_name | cut -d '"' -f 4)
RUN curl -sL $BASE_URL/$VERSION/geckodriver-$VERSION-linux64.tar.gz | tar -xz
RUN mv geckodriver /usr/local/bin/geckodriver
RUN chmod a+x /usr/local/bin/geckodriver

# run Xvfb in the background with a display number
RUN Xvfb :10 -ac &
ENV DISPLAY=:10

RUN pip install -r requirements.txt

CMD ["python", "app.py"]

requirements.txt

flask
robotframework
robotframework-selenium2library
robotframework-xvfb
selenium

以下是app repo

的链接

版本:

  • selenium 3.4.3
  • geckodriver 16.1 / 18.0
  • Robot Framework 3.0.2(linux2上的Python 2.7.12)
  • 来自/usr/lib/python2.7/site-packages(python 2.7)的
  • pip 9.0.1

我们非常感谢任何有关正确方向的帮助/指示。

0 个答案:

没有答案