本帖最后由 xzxnovice 于 2013-3-14 11:19 编辑 Func clickbyinnerText($oIE, $str)
$oElements = _IETagNameAllGetCollection($oIE)
For $oElement In $oElements
If String($oElement.innerText) = $str Then
$oElement.click
Return SetError(0, 0, $oElement)
ExitLoop
ConsoleWrite("Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText & @CRLF)
EndIf
Next
ConsoleWrite("找不到 " & $str & @CRLF)
Return SetError(1, 0, "找不到" & $str)
EndFunc ;==>clickbyinnerText
Func clickbutton($oIE, $str, $sf = "input")
$oElements = _IETagNameGetCollection($oIE, $sf)
For $oElement In $oElements
;~ ConsoleWrite("Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText & @CRLF)
If String($oElement.value) = $str Then
$oElement.click
Return SetError(0, 0, $oElement)
ConsoleWrite("find " & $str & @CRLF)
ExitLoop
EndIf
Next
ConsoleWrite("找不到 " & $str & @CRLF)
Return SetError(1, 0, "找不到" & $str)
EndFunc
$oIE=_IEAttach("trade.taobao.com","URL")
$oIE.document.all.J_SearchOrders.click
_IELoadWait($oIE)
$oIE.document.all.J_BatchExportBtn.click
_IELoadWait($oIE)
clickbyinnerText($oIE,"生成报表")
|