0
VBAを使用してIEでリンクをクリックする方法について多くの情報を読んでいますが、私の場合は動作しません。 、3つの異なる試みが指摘して、私は、試してみましたVBAコードVBAを使用してIE Webページのリンク/ボタンをクリックする
<div id="LinkButton_3" widgetId="LinkButton_3">
<a class="Row_Icon" data-dojo-attach-point="linkNode" data-dojo-attach-event="onClick:_onLinkButtonClicked">Company XYZ. - #12345</a>
</div>
次のとおりです: 関連するHTMLコードは次のようである私が間違っているかもしれないものに
Dim ieApp As SHDocVw.InternetExplorer
Dim ieDoc As MSHTML.HTMLDocument
Dim button As HTMLInputButtonElement
Dim div As HTMLDivElement
' Create a new instance of IE
Set ieApp = New InternetExplorer
' Uncomment this line for debugging purposes.
ieApp.Visible = True
' Go to the page we're interested in.
ieApp.Navigate "MyURL.com"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
' Try #1.
' Nothing happened on the web page after these 3 lines were executed.
Set button = ieDoc.getElementById("LinkButton_3")
button.Focus
button.Click
' Try #2
' Nothing happens - button is not clicked.
Set div = ieDoc.getElementById("LinkButton_3")
div.FireEvent "onClick"
' Try #3
' Nothing happens - button is not clicked.
div.Click
' Close the instance of IE.
ieApp.Quit
' Clean up.
Set ieApp = Nothing
Set ieDoc = Nothing
任意の考えや他の提案は大いに評価されるだろう。
あなたはをクリックし何TMC
の子をクリックすると、button.Children(0).Click'は動作しますか? –
マット、あなたは完全に素晴らしいです!それはうまくいった。 button.Clickとbutton.Children(0).Clickの違いを理解できます。再度、感謝します。 – TMc
本当にクリックしたいのは、div内のアンカー(a)タグです。したがって、そのdivの最初の子が必要です。それは役に立ちますか? –