Headless谷歌selenium使用
from selenium import webdriver import time from selenium.webdriver.chrome.options import Options #创建一个参数对象,用来控制Chrome以无界面模式打开 chrome_options = Options() #开启无头模式 chrome_options.add_argument(‘--headless‘) #禁用GPU chrome_options.add_argument(‘--disable-gpu‘) #驱动路径 path =r‘D:\chromedriver\chromedriver.exe‘ browser = webdriver.Chrome(executable_path=path,options=chrome_options) #上网 url = "http://www.baidu.com/" browser.get(url) time.sleep(3) browser.save_screenshot("baudu.png") #关闭 browser.quit()
相关推荐
人工智能快报 2020-11-21
xfcyhades 2020-11-20
Pokemogo 2020-11-16
guangcheng 2020-11-13
深圳克林斯曼 2020-11-09
机器之心 2020-11-06
Urchindong 2020-11-04
Michael 2020-11-03
章鱼之家 2020-10-29
fengyeezju 2020-10-14
hanfuquan0 2020-10-12
89347543 2020-10-10
韩伟佳 2020-10-09
lybbb 2020-09-29
关于学习本身 2020-09-24
Angelia 2020-09-11
刘炳昭 2020-09-10
tft0 2020-09-09