主题:网页中有两张同元素的图片,如何模拟单击想要的那张登陆?
最近写一款国外短信发送软件时遇到技术障碍。从该网站的网页源码上看,有几个tab,但是有两张登陆图片是几乎元素什么的都一模一样,我想软件模拟单击其中的一张登陆,可是怎么调试都是自动单击我不想要的那张,望高手支招。
网页代码1:
<H2>Sign in to My Vodafone Mobile</H2>
<P>Access & manage your mobile phone or mobile broadband account, web text
& more.</P>
<DIV class=module-content>
<DIV class=form-row>
<DIV class=form-label><LABEL for=mobile_number>Mobile number:</LABEL> </DIV>
<DIV class="form-input med-input"><INPUT id=mobile_number class=text-input
tabIndex=1 value=08 name=username> </DIV></DIV>
<DIV class=form-row>
<DIV class=form-label><LABEL for=myv_password>Password:</LABEL></DIV>
<DIV class="form-input med-input"><INPUT id=myv_password class=text-input
tabIndex=2 value="" type=password name=password> </DIV></DIV>
<DIV class=form-row>
<DIV class=form-input>[color=FF0000]<INPUT id=keep-me-signed-in_logonpage tabIndex=4 value=on
type=checkbox name=keeplogon jQuery1246197506534="27">[/color] <LABEL
for=keep-me-signed-in_logonpage>Keep me signed in for webtext</LABEL>
</DIV></DIV>
<DIV id=keep-me-signed-in-help-context-wrapper class=show-hide>
<DIV id=keep-me-signed-in-help-context>
<H2>Keep me signed in:</H2>
<P>By selecting this box you will stay signed in for 24 hours, but only for web
text and email features.</P>
<P>Don't select this if you're using a public or shared
computer.</P></DIV></DIV>
<DIV class=button-row><INPUT class=rollover title="Sign in" alt="Sign in"
src="/images/buttons/sign-in_btn_red.png" width=48 height=24 type=image
jQuery1246197506534="3"> <BR><A
href="/myv/services/forgottenpassword/index.jsp;jsessionid=2DAED67A613CB11F43451568046BC492?ts=1246197513470">Forgot
your password?</A> </DIV></DIV>
网页代码2
<H2>Sign in to Vodafone Business Online</H2>
<P>This service is for account managers of large mobile accounts.</P>
<DIV class=module-content>
<DIV class=form-row>
<DIV class=form-label><LABEL for=account_number>Account number:</LABEL> </DIV>
<DIV class="form-input med-input"><INPUT id=account-number class=text-input
name=accountnumber> </DIV></DIV>
<DIV class=form-row>
<DIV class=form-label><LABEL for=username>Username:</LABEL></DIV>
<DIV class="form-input med-input"><INPUT id=username class=text-input
name=userid></DIV></DIV>
<DIV class=form-row>
<DIV class=form-label><LABEL for=myv_password>Password:</LABEL></DIV>
<DIV class="form-input med-input"><INPUT id=mobile-password class=text-input
value="" type=password name=password></DIV></DIV>
<DIV class=button-row>[color=FF0000]<INPUT class=rollover title="Sign in" alt="Sign in"
src="/images/buttons/sign-in_btn_red.png" width=48 height=24 type=image
jQuery1246197506534="4">[/color] <BR></DIV></DIV>
这是我的代码:
Dim vDoc, vTag
Dim i As Integer
Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagname) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "image" And vTag.src = "https://www.vodafone.ie/images/buttons/sign-in_btn_red.png" Then
vTag.Click
End If
Next i
这是这个网站的网址:
https://www.vodafone.ie/myv/services/login/login.jsp
我想要点击的是这一张图片 “/images/buttons/sign-in_btn_red.png”
网页代码1:
<H2>Sign in to My Vodafone Mobile</H2>
<P>Access & manage your mobile phone or mobile broadband account, web text
& more.</P>
<DIV class=module-content>
<DIV class=form-row>
<DIV class=form-label><LABEL for=mobile_number>Mobile number:</LABEL> </DIV>
<DIV class="form-input med-input"><INPUT id=mobile_number class=text-input
tabIndex=1 value=08 name=username> </DIV></DIV>
<DIV class=form-row>
<DIV class=form-label><LABEL for=myv_password>Password:</LABEL></DIV>
<DIV class="form-input med-input"><INPUT id=myv_password class=text-input
tabIndex=2 value="" type=password name=password> </DIV></DIV>
<DIV class=form-row>
<DIV class=form-input>[color=FF0000]<INPUT id=keep-me-signed-in_logonpage tabIndex=4 value=on
type=checkbox name=keeplogon jQuery1246197506534="27">[/color] <LABEL
for=keep-me-signed-in_logonpage>Keep me signed in for webtext</LABEL>
</DIV></DIV>
<DIV id=keep-me-signed-in-help-context-wrapper class=show-hide>
<DIV id=keep-me-signed-in-help-context>
<H2>Keep me signed in:</H2>
<P>By selecting this box you will stay signed in for 24 hours, but only for web
text and email features.</P>
<P>Don't select this if you're using a public or shared
computer.</P></DIV></DIV>
<DIV class=button-row><INPUT class=rollover title="Sign in" alt="Sign in"
src="/images/buttons/sign-in_btn_red.png" width=48 height=24 type=image
jQuery1246197506534="3"> <BR><A
href="/myv/services/forgottenpassword/index.jsp;jsessionid=2DAED67A613CB11F43451568046BC492?ts=1246197513470">Forgot
your password?</A> </DIV></DIV>
网页代码2
<H2>Sign in to Vodafone Business Online</H2>
<P>This service is for account managers of large mobile accounts.</P>
<DIV class=module-content>
<DIV class=form-row>
<DIV class=form-label><LABEL for=account_number>Account number:</LABEL> </DIV>
<DIV class="form-input med-input"><INPUT id=account-number class=text-input
name=accountnumber> </DIV></DIV>
<DIV class=form-row>
<DIV class=form-label><LABEL for=username>Username:</LABEL></DIV>
<DIV class="form-input med-input"><INPUT id=username class=text-input
name=userid></DIV></DIV>
<DIV class=form-row>
<DIV class=form-label><LABEL for=myv_password>Password:</LABEL></DIV>
<DIV class="form-input med-input"><INPUT id=mobile-password class=text-input
value="" type=password name=password></DIV></DIV>
<DIV class=button-row>[color=FF0000]<INPUT class=rollover title="Sign in" alt="Sign in"
src="/images/buttons/sign-in_btn_red.png" width=48 height=24 type=image
jQuery1246197506534="4">[/color] <BR></DIV></DIV>
这是我的代码:
Dim vDoc, vTag
Dim i As Integer
Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagname) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "image" And vTag.src = "https://www.vodafone.ie/images/buttons/sign-in_btn_red.png" Then
vTag.Click
End If
Next i
这是这个网站的网址:
https://www.vodafone.ie/myv/services/login/login.jsp
我想要点击的是这一张图片 “/images/buttons/sign-in_btn_red.png”