selenium +chrome headless Manual 模式渲染网页
可以看看这个里面的介绍,写得很好。https://duo.com/blog/driving-headless-chrome-with-python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options`
chrome_options = Options()
chrome_options.add_argument("--headless") ##需要加上,否则会弹出真实浏览器
chrome_options.binary_location ='
/opt/google/chrome/chrome'
driver = webdriver.Chrome(executable_path="
/home/xxxx/Downloads/chromedriver",chrome_options=chrome_options)
http://chromedriver.storage.googleapis.com/index.html,
准备条件是selenium3.4 ,py2或py3,chrome 59或60版本,chrome driver 2.30。看文章里面写的介绍是chrome金丝雀版本,但59版本以后有headless模式了。
附上chromedriver下载地址
60版本的chrome 下载2.30就可以。
反对极端面向过程编程思维方式,喜欢面向对象和设计模式的解读,喜欢对比极端面向过程编程和oop编程消耗代码代码行数的区别和原因。致力于使用oop和36种设计模式写出最高可复用的框架级代码和使用最少的代码行数完成任务,致力于使用oop和设计模式来使部分代码减少90%行,使绝大部分py文件最低减少50%-80%行的写法。