无头浏览器

from selenium  import  webdriver
from  selenium.webdriver.chrome.options  import Options
#实现无头浏览器
chrome_options=Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")



driver=webdriver.Chrome(options=chrome_options)
driver.get("http://quotes.toscrape.com/")
a=driver.find_elements_by_xpath('//span[@class="text"]')
for i in a:
    print(i.text)
原文地址:https://www.cnblogs.com/luckiness/p/13406952.html