[英]Scraping the portion of HTML code (not text) using selenium in python
不,可以用硒提取選定的 html。 要么您可以提取完整的 html,要么您必須一個一個地提取每個元素:
使用outerHTML提取整個標題標簽(包括標題):
elem = driver.find_element_by_class_name("header cf")
source_code = elem.get_attribute("outerHTML")
提取導航中的所有內容(包括導航):
elem = driver.find_element_by_class_name("nav")
source_code = elem.get_attribute("outerHTML")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.