-5
</div></div></div><div class="f u" id="m_more_item"><a href="/browse/likes/?id=1026395497374065&amp;start=30&amp;refid=53"><span>Diğerlerini Gör</span></a></div></div></div></div></div></div></div></body></html>

DOCUMENT

CODE:

Dim h1 As HtmlElementCollection = Nothing
    h1 = W.Document.GetElementsByTagName("div")
    For Each curElement As HtmlElement In h1
        If InStr(curElement.GetAttribute("classname").ToString, "f u") Then

            curElement.InvokeMember("Click")

BUT code does not work HELP ME ?

2 Answers2

0

Off my Example: VB.Net - select a class using GetElementByClass and then click the item programmatically

The problem is your trying to click the DIV instead of trying to click the A HREF tag. You will want to do that instead.

Since there is no "class" or anything on that element, then you could do something like...

Dim h1 As HtmlElementCollection = Nothing
    h1 = W.Document.GetElementsByTagName("div")
    For Each h1Element as HtmlElement in h1
        Dim NameStr As String = h1Element.GetAttribute("href")
        If ((NameStr IsNot Nothing) And (NameStr.Length <> 0)) Then 
            h1Element.InvokeMember("Click")
Community
  • 1
  • 1
eqiz
  • 1,521
  • 5
  • 29
  • 51
  • m.facebook.com/browse/likes?id=1026395497374065 div > div > div > < div class = "fu" id = "m_more_item" > < a href = "/ Tarama / seviyor / id = 1026395497374065 & amp;? start = 30 & amp; refid = 53" > < açıklıklı > Di ğ erlerini G ö r yayılma > a > div > div > div > div > div > div > div > body > html > Ben "diğerlerini Gör" butonuna tıklayın istiyorum Code verdi işe yaramadı :( Ben isteyenler almak istiyorum. – Yavuz Selim Özmen Apr 02 '15 at 13:50
  • I want to "Diğerlerini Gör" button click Code did not work that you gave :( I want to get those who like. – Yavuz Selim Özmen Apr 02 '15 at 13:50
  • @eqiz can you undelete that other answer just for a second? – Hanky Panky Jul 01 '15 at 09:27
0
Dim theElementCollection As HtmlElementCollection = Nothing

For Each Element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")

            If Element.GetAttribute("id") = "m_more_item" And Element.OuterHtml.Contains("Diğerlerini Gör") Then
                Element.InvokeMember("click")
            End If

        Next