Click here to Skip to main content
13,052,558 members (57,479 online)
Rate this:
 
Please Sign up or sign in to vote.
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
Updated 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 1

Try putting id attribute for the input button like:



  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  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2017
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