पर क्लिक करें मैं HTML/AJAX में कक्षा द्वारा तत्व को पढ़ने के लिए इस कोड का उपयोग करने का प्रयास कर रहा हूं, GetElementByClass WebBrowser.Document में कोई विकल्प नहीं है। मुझे रिटर्न वैल्यू नहीं मिल रहा है तो सदस्य को बुलाओ। क्या इसके आसपास कोई कार्य है?GetElementByClass द्वारा कक्षा का चयन कैसे करें और प्रोग्राम पर
संदर्भ: Getting HTMLElements by Class Name
उदाहरण:
<span class="example">(<a href="http://www.test.com/folder/remote/api?=test" onclick=" return do_ajax('popup_fodder', 'remote/api?=test', 1, 1, 0, 0); return false; " class="example">test</a>)</span>
उदाहरण कोड:
HtmlElementCollection theElementCollection = default(HtmlElementCollection);
theElementCollection = webBrowser1.Document.GetElementsByTagName("span");
foreach (HtmlElement curElement in theElementCollection)
{
//If curElement.GetAttribute("class").ToString = "example" It doesn't work.
// This should be the work around.
if (curElement.OuterHtml.Contains("example"))
{
MessageBox.Show(curElement.GetAttribute("InnerText")); // Doesn't even fire.
// InvokeMember(test) after class is found.
}
}
बहुत बढ़िया, का एक कांटा का उपयोग करने का काम करता है के बजाय
GetAttribute("className")
उपयोग करने की आवश्यकता jQuery? ;) –संदेशबॉक्स। दिखाओ मुझे यह पाठ दिखाया गया था जो इसे पुनर्प्राप्त किया गया था। JQuery मैं परिचित नहीं हूँ। इस मामले में एक उदाहरण मिला? – Nightforce2