https://github.com/microsoft/playwright-python
https://github.com/microsoft/playwright/blob/master/docs/docker/Dockerfile.focal
sudo apt update sudo apt install -y libwoff1 libopus0 libwebp6 libwebpdemux2 libenchant1c2a libgudev-1.0-0 libsecret-1-0 libhyphen0 libgdk-pixbuf2.0-0 libegl1 libnotify4 libxslt1.1 libevent-2.1-7 libgles2 libxcomposite1 libatk1.0-0 libatk-bridge2.0-0 libepoxy0 libgtk-3-0 libharfbuzz-icu0 libgstreamer-gl1.0-0 libgstreamer-plugins-bad1.0-0 gstreamer1.0-plugins-good gstreamer1.0-libav libnss3 libxss1 libasound2 fonts-noto-color-emoji libxtst6 libdbus-glib-1-2 libxt6 ffmpeg xvfb
sudo apt install python3-pip
pip3 install playwright
python3 -m playwright install
フォントをインストール
sudo apt install fonts-ipafont-gothic fonts-ipafont-mincho
Python
https://github.com/microsoft/playwright-python
スクリーンショット
from playwright import sync_playwright with sync_playwright() as p: for browser_type in [p.chromium, p.firefox, p.webkit]: browser = browser_type.launch() page = browser.newPage() page.goto("https://www.yahoo.co.jp/") page.screenshot(path=f"yahoo-{browser_type.name}.png") browser.close()