单击一个具有与其他按钮相似的值的按钮 [英] Clicking a button that has similar values as other buttons

查看:75
本文介绍了单击一个具有与其他按钮相似的值的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我不会问这个,但是它已经让我疯狂了6个小时,我不知道如何单击此按钮,

相信我,香港专业教育学院尝试了50种不同的方法,任何帮助都将是十足的

这是html,我只是想点击关注

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

推荐答案

K,好吧,我在Twitter上找到了关注按钮的解决方法,

您要做的就是在人员名称之后放置/跟随,因此,如果您要遵循
奥普拉,那么这将是转到的链接

https://mobile.twitter.com/oprah/follow

然后是下面的代码,单击已起作用的跟随"按钮,最终",大声笑

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


尝试为输入按钮添加id属性,例如:



Try putting id attribute for the input button like:




AmolPandurangBorkar,

正如您所说,我使用id属性尝试了这两种方法,但是它们没有任何其他想法,我现在不愿意尝试任何方法,

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


这篇关于单击一个具有与其他按钮相似的值的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆