CentOS7 安装chrome浏览器和ChromeDriver

2021-07-30  本文已影响0人  Fizz_YF

环境:


1、centos7 安装 chrome浏览器

image.png

2、配置Chrome Driver

3、Python 调用chrome

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--headless')
browser = webdriver.Chrome(chrome_options=chrome_options)

browser.get('https://www.baidu.com')
print(browser.page_source)

==这儿有两个坑:==

上一篇 下一篇

猜你喜欢

热点阅读