Sign inSign up

marceloaba/python-chromedriver-headless

By marceloaba

•Updated over 6 years ago

Alpine image with python and chromium ready to run Webscraping script headless

Image
0

100K+

marceloaba/python-chromedriver-headless repository overview

Dockerfile:

FROM alpine:3.11.6

RUN apk update ; apk add python3 chromium chromium-chromedriver curl

RUN pip3 install --upgrade pip

RUN pip install selenium bs4

⁠Python Script import and chrome example

from selenium import webdriver

from selenium.webdriver.chrome.options import Options

from selenium.webdriver.common.keys import Keys

from selenium.webdriver.support.ui import Select

from selenium.webdriver.common.action_chains import ActionChains

from bs4 import BeautifulSoup

import re

chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument('--no-sandbox')

chrome_options.add_argument('--headless')

chrome_options.add_argument('--disable-gpu')

browser = webdriver.Chrome(options=chrome_options)

Tag summary

Content type

Image

Digest

Size

371.6 MB

Last updated

over 6 years ago

docker pull marceloaba/python-chromedriver-headless