点击蓝色按钮(点击vbs中的js按钮)

Button clicking blues (click js button from vbs)

本文关键字:按钮 中的 js vbs 蓝色 点击      更新时间:2023-09-26

就在我以为我可以处理任何按钮的时候,我发现一个按钮对我尝试的任何东西都没有响应。这是我的代码的基本框架(非常基本)。正在尝试打开此页面,然后单击"下一页"按钮。

Set objWshShell = Wscript.CreateObject("Wscript.Shell")
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.Navigate "http://centraloklahomaproperties.com/SiteContent/OKC/MemberSearchOKC.aspx"
Do Until IE.ReadyState = 4: WScript.sleep 100: Loop
On error resume next
Dim i
i = 0
Do while i < 5
i = i + 1
Do Until IE.ReadyState = 4: WScript.sleep 100: Loop
'Click button here!
Loop

我尝试过的东西:

1) IE.Navigate "javascript:open.document.getElementByID('btnRight').onclick;"
2) IE.Navigate "Javascript:window.opener.btnright.click();"
3) For Each btn In IE.Document.getElementsByTagName("img")
If btn.id = "btnRight" Then btn.Click()
Next
4) ie.navigate "javascript:InvokeScript('Next(1)');"
5) Browser.InvokeScript("Next(1)")
6) ie.Navigate( Uri("javascript:(function(){ Next(1); })();") )
7) Set oButton = IE.getElementById("btnRight")
oButton.Click()

也尝试了以下方法:如何在VB 上单击js按钮

这是按钮html:

<img width="30" height="28" id="btnRight" onmouseover="Tab(event)" onmouseout="Tab(event)" onclick="Next(1);" alt="Next" src="http://centraloklahomaproperties.com/SiteContent/OKC/images/icon_arrow_next-default.gif">

奇怪的是,除非我特别右键单击左边的框架并查看源,否则这个框架就好像根本不存在一样。如果我只是在IE中打开页面,然后转到>编辑>源,它是不存在的。可能是我问题的一部分。

尝试更改:

Set IE = CreateObject("internetexplorer.application")

Set IE = WScript.CreateObject("InternetExplorer.Application","objIE_")

怎么样:

Set oButton = IE.getElementById("btnRight")
oButton.Click()