2017-12-15 5 views
0
<tr><td colspan="3" class="sms_content">4173 message  </td></tr> 

テキストボックスにhtmlデータが表示されますが、私は失敗して助けが必要です。C#テキストボックスにgeckowebbrowser tr tableto htmalデータが表示される可能性はありますか?

以下のコードを試しています。

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 
      { 

      } 
     } 

あなたが任意のより良いソリューションを提供するので、もしそれが、それはすべてのためにも、私&にとって本当に素晴らしいことだ私にとって本当に重要です。

答えて

0

あなたのforeachループのように見えるのは、TD要素ではなくTR要素を反復していることです。したがって、属性を取得しようとしているときは、TRには属性がないため、何も返しません。試してみよう:

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 
     } 
    } 
} 
関連する問題