调用IE.au3的_IELinkClickByText或_IEAction,下载文件,保存文件对话框一闪而过,如解
url地址http://www.sciencedirect.com/science/article/pii/B9780122841514500002
我用_IEAction($oLink, "focus"),后面加个Send("{Enter}")可以实现代码如下,问题是_IEAction($oLink, "click"),为何会出现对话框一闪而过呢?
#include <IE.au3>
$oIE = _IECreate("http://www.sciencedirect.com/science/article/pii/B9780122841514500002")
Local $sMyString = "pdf"
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
Local $sLinkText = _IEPropertyGet($oLink, "innerText")
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "focus")
ExitLoop
EndIf
Next
Send("{Enter}")
;-----------------------------
;错误代码
;-----------------------------
#include <IE.au3>
$oIE = _IECreate("http://www.sciencedirect.com/science/article/pii/B9780122841514500002")
Local $sMyString = "pdf"
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
Local $sLinkText = _IEPropertyGet($oLink, "innerText")
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "click")
ExitLoop
EndIf
Next
页:
[1]