HtmlDocument.GetElementById("$id")
Run Code Online (Sandbox Code Playgroud)
我想使用此方法来获取元素$id,但它匹配具有meta与其具有相同值的属性的标记$id.
HtmlDocument是这样的:
<html>
<head>
<meta name="description" content="">
</head>
<body>
<div id="description"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我试图获取divid为"description"的标签:
HtmlElement elem = doc.GetElementById("description");
Run Code Online (Sandbox Code Playgroud)
但我得到了meta而不是div.为什么meta标签匹配?