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)