标签:gpu and img 界面 t权限 https import inf taobao
yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
安装必要的库 yum install mesa-libOSMesa-devel gnu-free-sans-fonts wqy-zenhei-fonts
wget http://npm.taobao.org/mirrors/chromedriver/2.41/chromedriver_linux64.zip #将下载的文件解压 unzip chromedriver_linux64.zip mv chromedriver /usr/bin/ #给予执行权限 chmod +x /usr/bin/chromedriver
from selenium.webdriver.chrome.options import Options from selenium import webdriver from time import sleep chrome_options = Options() """ “–no-sandbox”参数是让Chrome在root权限下跑 “–headless”参数是不用打开图形界面 """ chrome_options.add_argument(‘--no-sandbox‘) chrome_options.add_argument(‘--disable-dev-shm-usage‘) chrome_options.add_argument(‘--headless‘) chrome_options.add_argument(‘blink-settings=imagesEnabled=false‘) chrome_options.add_argument(‘--disable-gpu‘) browser = webdriver.Chrome(chrome_options=chrome_options) browser.get(‘https://www.taobao.com/‘) sleep(2) page_text = browser.page_source print(page_text[0:100])
标签:gpu and img 界面 t权限 https import inf taobao
原文地址:https://www.cnblogs.com/xiao-apple36/p/12688772.html