簡體   English   中英

單擊藍色的按鈕(從vbs單擊js按鈕)

[英]Button clicking blues (click js button from vbs)

就在我認為我可以處理任何按鈕的時候,我遇到了一個響應我沒有嘗試的按鈕。 這是我的代碼的基本框架(非常基本)。 只是嘗試打開此頁面並單擊下一頁按鈕。

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()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM