2015-11-26 52 views
1

嘗試使用AutoIT自動從Amazon Seller Central主頁點擊'Unshipped'小部件。這裏是我的功能看起來像,我試圖遵循維基中的獲取鏈接的集合,然後循環他們,但似乎並沒有爲我工作。在AutoIT中點擊特定的href

#include <IE.au3> 
#include <MsgBoxConstants.au3> 


Navigate("Unshipped") 

Func Navigate($sNavigate) 
    Local $oIE = "https://sellercentral.amazon.com/hz/home" 
    Local $oLinks = _IELinkGetCollection($oIE) 

    Local $iNumLinks = @extended 

Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF 
For $oLink In $oLinks 
    $sTxt &= $oLink.href & @CRLF 
Next 
MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt) 

EndFunc 

回答

2

我無法登錄到亞馬遜賣家的中央主頁,但這應該可以工作。我在登錄頁面上測試它,它工作正常。只要確保您使用的是全局變量/相同的IE窗口,以便您保持登錄狀態。在此示例中,您運行登錄函數時,要確保使用全局變量$ g_oIE而不是$ oIE。

#include <IE.au3> 
#include <MsgBoxConstants.au3> 

;start IE with a Global variable 
Global $g_oIE = _IECreate() 

;run your login fuction here using the global variable $g_oIE and check to make sure you are logged in. 

;should get your links (it uses the global IE variable) 
GetLinkCollection() 

Func GetLinkCollection() 
    _IENavigate($g_oIE, "https://sellercentral.amazon.com/hz/home") 

    Local $oLinks = _IELinkGetCollection($g_oIE) 

    Local $iNumLinks = @extended 

    Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF 
    For $oLink In $oLinks 
     $sTxt &= $oLink.href & @CRLF 
    Next 
    MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt) 

EndFunc ;==>GetLinkCollection 
+0

再次感謝MrAutoIt! –