Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C C# VB Visual-Studio VB.NET , +
Hi guys,,
 
i would not ask this but its been driving me crazy now for 6 hours and i cant figure out how to click this button,,
 
trust me,, ive tried 50 different things,, any help would be great-full
 
here is the html, i am simply trying to click the Follow
<div class="profile-actions">
        <form action="/BaltimoreBama/follow" method="post">
          <div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="a15a8f386c94dc625fd6" /></div>
          
          <span class="w-button-common w-button"><input name="commit" type="submit" value="Follow" /></span>
        </form>
        <form action="/BaltimoreBama/favorites" method="get">
          <span class="w-button-common w-button"><input name="commit" type="submit" value="View favs" /></span>
        </form>
          <form action="/BaltimoreBama/block" method="post">
            <div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="a15a8f386c94dc625fd6" /></div>
            
            <span class="w-button-common w-button"><input name="commit" type="submit" value="Block" /></span>
          </form>
</div>
  </div>
 
 
Thinks i have tried,, too many to list but here are a couple
 
 If WebBrowser12.Document.DomDocument.All("value").Value = ("Follow") Then
 
            WebBrowser12.Document.DomDocument.All.Focus()
            WebBrowser12.Document.DomDocument.All.InvokeMember("click")
        Else
 
        End If
 
and
 
 Dim ii As Integer
        Dim allButtonsi As HtmlElementCollection
 
        allButtonsi = WebBrowser12.Document.GetElementsByTagName("input")
        'screen_names[]
        ii = 0
        Try
            For Each webpageelement As HtmlElement In allButtonsi
                Dim NameStr As String = webpageelement.GetAttribute("value")
                If NameStr.ToLower().Equals("Follow") Then
                    ii += 1
                    If ii = 1 Then
                        webpageelement.Focus()
                        webpageelement.InvokeMember("click")
                    End If
                End If
 
            Next
        Catch
        End Try
Posted 25-Sep-12 7:27am
Edited 25-Sep-12 7:32am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

K,, well,, i found a work around for the follow button on twitter,
 
all you do is place /follow after the persons name, hence,, if you were to follow
oprah,, then this would be the link to go to

https://mobile.twitter.com/oprah/follow
 
then here is the code to click the follow button that has worked,, FINALLY,, LOL
 
 
 Try
            WebBrowser12.Document.DomDocument.All("commit").Click()
            Do Until WebBrowser12.ReadyState = System.Windows.Forms.WebBrowserReadyState.Complete
                System.Windows.Forms.Application.DoEvents()
                ' wait(1000)
                ' Delay(1)
            Loop
        Catch
        End Try
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

AmolPandurangBorkar,
 
i tried both of these with the id attribute as you said and they did not work,, any other ideas,, im willing to try anything at this point,,
 
 Dim ii As Integer
        Dim allButtonsi As HtmlElementCollection
 
        allButtonsi = WebBrowser12.Document.GetElementsByTagName("input")
        'screen_names[]
        ii = 0
        Try
            For Each webpageelement As HtmlElement In allButtonsi
                Dim NameStr As String = webpageelement.GetAttribute("value")
                If NameStr.ToLower().Equals("a15a8f386c94dc625fd6") Then
                    ii += 1
                    If ii = 1 Then
                        webpageelement.Focus()
                        webpageelement.InvokeMember("click")
                    End If
                End If
 
            Next
        Catch
        End Try
 
and
 

 If WebBrowser12.Document.DomDocument.All("value").Value = ("a15a8f386c94dc625fd6") Then
 
            WebBrowser12.Document.DomDocument.All.Focus()
            WebBrowser12.Document.DomDocument.All.InvokeMember("click")
        Else
 
        End If
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try putting id attribute for the input button like:
 
<input name="authenticity_token" id="input1" type="hidden" value="a15a8f386c94dc625fd6" />
 
<input name="authenticity_token" id="input2" type="hidden" value="a15a8f386c94dc625fd6" />
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 470
1 mhegazy94 460
2 Ravi Bhavnani 190
3 Kornfeld Eliyahu Peter 185
4 Shemeemsha RA 160
0 Sergey Alexandrovich Kryukov 7,135
1 OriginalGriff 6,801
2 CPallini 5,350
3 George Jonsson 3,619
4 Gihan Liyanage 2,797


Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100