2014-06-14 82 views
-2
#include <IE.au3> 
Local $oIE = _IECreate("http://google.com") 
_IELoadWait($oIE) 
While 1 
_IENavigate($oIE, "http://mywebsite") 
_IELoadWait($oIE) 
_IELinkClickByText($oIE, "1oZMQ2E") 
sleep(600) 
WEnd 

此腳本在Windows XP和7中無限循環,沒有任何問題。Internet Explorer自動化在Windows 8中不起作用

但在Windows 8.1和8中,它無法正常工作。只打開頁面並保留在那裏。沒有循環。我嘗試了其他腳本,但同樣的事情發生。我很困惑。

回答

0

使用_IECreateEmbedded將使IE在兼容模式下工作(IE8)。

如果現在你需要,你可以運行這個代碼一次,然後所有的IE實例將以兼容模式運行。

#RequireAdmin 
    $64Bit = "" 
    If @OSArch = "X64" Then 
     $64Bit = "64" 
    EndIf 
If StringLeft(RegRead("HKLM" & $64Bit & "\SOFTWARE\Microsoft\Internet Explorer\Version Vector", "IE"), 1) > 8 Then ;Check for version 9 or later 


    $wshNetwork = ObjCreate("WScript.Network") 
    $struser = $wshNetwork.Username 
    $objWMIService = ObjGet("winmgmts:\\.\root\cimv2") 
    $objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"') 
    RegWrite("HKU" & $64Bit & "\" & $objAccount.SID & "\Software\Microsoft\Internet Explorer\BrowserEmulation\", "AllSitesCompatibilityMode", "REG_DWORD", 1) 
    RegWrite("HKU\" & $objAccount.SID & "\Software\Microsoft\Internet Explorer\BrowserEmulation\", "AllSitesCompatibilityMode", "REG_DWORD", 1) 
EndIf 
相關問題