0
<tr><td colspan="3" class="sms_content">4173 message      </td></tr>

I am want html data show in our textbox but I am fail so need help.

Below code I am trying.

 GeckoElementCollection tagsCollection = geckoWebBrowser1.Document.GetElementsByTagName("tr");

        foreach (GeckoElement currentTag in tagsCollection)
        {
            if (currentTag.GetAttribute("colspan").Contains("3"))
            {
                ((GeckoHtmlElement)currentTag).GetAttribute(textBox36.Text);


                delay(300);


            }

            else
            {

            }
        }

It's really important for me so if you provide any better solution then it's really great for me & also for all.

4

1 回答 1

0

Looks like in your foreach loop you are iterating through TR elements, not TD. So when you are trying to get attribute, it returns nothing, because TR does not have it. Try this:

var tagsCollection = Browser.Document.GetElementsByTagName("tr");

foreach (var tr in tagsCollection) // iterate through TR
{
    foreach (var td in tr.ChildNodes) // iterate through TD
    {
        if (td.GetAttribute("colspan").Contains("3"))
        {
            var attr = td.GetAttribute(textBox36.Text);

            // some other code
        }
    }
}
于 2017-12-16T15:47:07.633 回答