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 fonts-ipafont-gothic fonts-ipafont-mincho
sudo apt install python3-pip
pip3 install playwright
#Installieren Sie Chrom / Firefox / WebKit
python3 -m playwright install
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("http://whatsmyuseragent.org/")
page.screenshot(path=f"example-{browser_type.name}.png ")
browser.close()
from playwright import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.newPage()
page.goto("http://www.nikkei.com/markets/kabu/")
# html = page.content()
print(page.innerText("span.mkc-stock_prices"))
browser.close()
Recommended Posts