selenium-禁止图片加载
作者:互联网
#!encoding=utf-8 from lxml import etree from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() No_Image_loading = {"profile.managed_default_content_settings.images": 2} options.add_experimental_option("prefs", No_Image_loading) browser = webdriver.Chrome(options=options) browser.get("http://www.taobao.com") content = browser.page_source html = etree.HTML(content) title = html.xpath('//div[@class="ui blue segment"]/div[2]/text()') print(title)
标签:webdriver,禁止,selenium,content,import,browser,options,加载 来源: https://www.cnblogs.com/brady-wang/p/15856545.html