Skip to content

Commit

Permalink
Switch to firefox driver
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Sep 19, 2023
1 parent 1da85c8 commit 2f64064
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# https://github.com/joyzoursky/docker-python-chromedriver
FROM joyzoursky/python-chromedriver:3.9
# https://github.com/TomRoush/python-selenium-firefox-docker
# FROM tomroush/python-selenium-firefox-docker:latest
FROM ubuntu:20.04

ENV SELENIUM_HEADLESS=true
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
python3 python3-pip \
firefox-geckodriver \
xvfb \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install --no-cache-dir selenium

RUN pip install selenium
ENV SELENIUM_HEADLESS=true

ADD page_perf_timer.py /opt/page_timer/

WORKDIR /opt/page_timer

ENTRYPOINT ["python", "page_perf_timer.py"]
ENTRYPOINT ["python3", "page_perf_timer.py"]
10 changes: 5 additions & 5 deletions page_perf_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def __init__(
self.timings = {}

"""Start web driver"""
chrome_options = webdriver.ChromeOptions()
options = webdriver.FirefoxOptions()
if os.environ.get("SELENIUM_HEADLESS"):
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
self.driver = webdriver.Chrome(options=chrome_options)
options.add_argument("--no-sandbox")
options.add_argument("--headless")
options.add_argument("--disable-gpu")
self.driver = webdriver.Firefox(options=options)
# self.driver = webdriver.Firefox()
self.driver.implicitly_wait(180)
self.wait = WebDriverWait(self.driver, 180)
Expand Down

0 comments on commit 2f64064

Please sign in to comment.