Automate the Firefox browser with Python
356
What's included:
Acquire the Docker image:
docker pull agentlans/firefox-selenium
Start a temporary container from the image. By default, it goes to the Python prompt.
docker run --rm -it agentlans/firefox-selenium
You can also call Python from the container. If you want to run a Python script, you should copy the file into the container first.
docker run --rm -it agentlans/firefox-selenium python3 my_selenium_script.py
Try some Python code to make sure the Firefox driver works:
# Try running this code by copying and pasting to the Python prompt:
from selenium import webdriver
from selenium.webdriver.common.by import By # for selecting HTML tags
from selenium.webdriver import FirefoxOptions
options = FirefoxOptions()
options.headless = True # No GUI
driver = webdriver.Firefox(options=options)
driver.get("https://www.google.com")
driver.title # => "Google"
driver.quit()
The Dockerfile is Copyright ©️ 2022 Alan Tseng
GNU General Public License v3
The actual built image (that is, the one on Docker Hub) is covered by the licenses of Docker, Debian, Firefox, Python, and Selenium. Please see their websites for details.
Content type
Image
Digest
sha256:9116097f1…
Size
358.7 MB
Last updated
over 2 years ago
docker pull agentlans/firefox-selenium