AutoIt中如何获取div的值?
How to get the value of a div in AutoIt?
在这种情况下,我想从此列表中获取最后一个 div 的特定值:
<div id="past">
<div class="ball ball-8" data-rollid="242539">11</div>
<div class="ball ball-8" data-rollid="242540">11</div>
<div class="ball ball-1" data-rollid="242541">3</div>
<div class="ball ball-8" data-rollid="242542">11</div>
<div class="ball ball-1" data-rollid="242543">5</div>
<div class="ball ball-1" data-rollid="242544">2</div>
<div class="ball ball-1" data-rollid="242545">7</div>
<div class="ball ball-8" data-rollid="242546">14</div>
<div class="ball ball-1" data-rollid="242547">4</div>
<div class="ball ball-1" data-rollid="242548">3</div>
</div>
我只想从该块的最后一个条目中获取 outerText。在这种情况下,它将是 3 和 rollid="242548"
。
我怎么能得到这个值?
我试过了:
$lasts = _IETagNameGetCollection($create, "div")
For $last In $lasts
If String($last.id) = "past" And String($last.innerText) = "242548" Then
$get = _IEGe
MsgBox(0,"","")
$outer = $last.outerText
GUICtrlSetData( $labellast, $outer)
EndIf
Next
但它不起作用。
有什么建议吗?
试试这个
$past = _IEGetObjById($oIE,"past" )
$lasts = _IETagNameGetCollection($past, "div")
For $last In $lasts
If StringInStr($last.outerHtml, "242548") Then
$outer = $last.outerText
GUICtrlSetData( $labellast, $outer)
EndIf
Next
在这种情况下,我想从此列表中获取最后一个 div 的特定值:
<div id="past">
<div class="ball ball-8" data-rollid="242539">11</div>
<div class="ball ball-8" data-rollid="242540">11</div>
<div class="ball ball-1" data-rollid="242541">3</div>
<div class="ball ball-8" data-rollid="242542">11</div>
<div class="ball ball-1" data-rollid="242543">5</div>
<div class="ball ball-1" data-rollid="242544">2</div>
<div class="ball ball-1" data-rollid="242545">7</div>
<div class="ball ball-8" data-rollid="242546">14</div>
<div class="ball ball-1" data-rollid="242547">4</div>
<div class="ball ball-1" data-rollid="242548">3</div>
</div>
我只想从该块的最后一个条目中获取 outerText。在这种情况下,它将是 3 和 rollid="242548"
。
我怎么能得到这个值?
我试过了:
$lasts = _IETagNameGetCollection($create, "div")
For $last In $lasts
If String($last.id) = "past" And String($last.innerText) = "242548" Then
$get = _IEGe
MsgBox(0,"","")
$outer = $last.outerText
GUICtrlSetData( $labellast, $outer)
EndIf
Next
但它不起作用。 有什么建议吗?
试试这个
$past = _IEGetObjById($oIE,"past" )
$lasts = _IETagNameGetCollection($past, "div")
For $last In $lasts
If StringInStr($last.outerHtml, "242548") Then
$outer = $last.outerText
GUICtrlSetData( $labellast, $outer)
EndIf
Next