selenium +xpath
#!encoding=utf-8 from lxml import etree from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_argument('--headless') browser = webdriver.Chrome(options=options) browser.get("https://www.cnblogs.com/brady-wang/") content = browser.page_source html = etree.HTML(content) title = html.xpath('//*[@id="Header1_HeaderTitle"]/text()') print(title) browser.close()