1. Python模块安装
pip install selenium pip install webdriver-manager
2. Chromium和Driver安装
sudo apt update && sudo apt install chromium chromium-driver
3. 测试代码
# selenium 4 import shutil from selenium import webdriver from selenium.webdriver.chrome.service import Service as ChromeOrChromiumService from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.core.utils import ChromeType # don't forget in your installation script : # sudo apt update && sudo apt install chromium chromium-driver if (shutil.which('chrome') or shutil.which('chromium')) and shutil.which('chromedriver') : service = ChromeOrChromiumService() else: service = ChromeOrChromiumService(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()) driver = webdriver.Chrome(service=service)
参考链接:
1.Selenium: geckodriver executable needs to be in PATH? | ScrapingBee
2.Can support ARM64 for chromium? · Issue #436 · SergeyPirogov/webdriver_manager (github.com)
标签:webdriver,service,selenium,install,Ubuntu,import,chromium,ARM From: https://www.cnblogs.com/hicoffee/p/17499177.html