赞
踩
简单demo如下
# coding: utf-8
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
client = webdriver.Chrome(chrome_options=chrome_options)
# 如果没有把chromedriver加入到PATH中,就需要指明路径 executable_path='/home/chromedriver'
client.get("https://www.aliyun.com/jiaocheng/124644.html")
content = client.page_source
print(content)
client.quit()
如果content打印出正确内容,说明程序运行成功
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。