2016-05-04 11 views
1

私はMsxml2.XMLHTTPが動作しないように非常に複雑なウェブサイトにアクセスしています。私はfollowint Ie Automationを試みた。必要なテキストがインターネットエクスプローラにロードされているか確認してください

'Working 
with createobject("internetexplorer.application") 
    .navigate url 
    Do While .ReadyState = 4: WScript.Sleep 1000: Loop 
    Do While .ReadyState <> 4: WScript.Sleep 1000: Loop 
    .document.body.createtextrange.select 
    .document.execCommand "copy" 
    strURL = .document.parentwindow.clipboardData.GetData("text")   
    .quit 
end with 
MsgBox strURL 

しかし、このたびはinstr(strURL, "some text") is trueまで

私は、Webページをロードする場合Failproof Wait for IE to loadで未回答のように完全なコンテンツをロードし、どのような方法はありますか?

なぜ.ReadyState = 4がページをロードしないのか分かりません。 JavaScriptの準備ができていない可能性がありますか?

このようにもう1つ寝ました。

If Not instr(strtxt, "some Text") > 0 then 
     WScript.Sleep 10000 
    .document.body.createtextrange.select 
    .document.execCommand "copy" 
    strtxt = .document.parentwindow.clipboardData.GetData("text") 

私の環境ではほとんどの場合結果が得られますが、必要なテキストがロードされるまでチェックする方法はありません。

答えて

0

これはアイデアです。

keepSleeping = false 'is my requirement 
keepSleeping=instr(.document.body.innerhtml, "sometext") <> 0 
while keepSleeping 
    WScript.Sleep 20 
    keepSleeping=instr(.document.body.innerhtml, "sometext") 
wend 
関連する問題