0
이 예제를 사용하면 C# HTMLElement의 Get Attribute를 사용하여이 줄에 "GOOGLE CLICK"을 어떻게 얻을 수 있습니까? 이 요소가 getElementByTagName을 사용하여 흡수되었다고 가정합니다. 내가 해봤 사용하는 속성이 어떤 종류의 확실하지 않다 "HTML"& "텍스트"(예. element.GetAttribute ("HTML")) 슬프게하지에 자바 작업되지만 속성 기음#.HTMLElement의 GetAttribute ("html") 또는 GetAttribute ("text")가 값을 반환하지 않음
<a href="www.google.com">GOOGLE CLICK</a>
여기서는 참조 할 수있는 C# 예제 코드를 실행하려고합니다.
//web is the current page i am at.
HtmlElementCollection links = web.Document.GetElementsByTagName("a");
foreach (HtmlElement link in links)
{
if (link.GetAttribute("text") == "GoogleClick")
MessageBox.Show(this, "Hooray I got it!");
}