【已解决】这个网页元素怎么就点不上呢?
本帖最后由 wjqzywmm 于 2012-7-16 17:18 编辑网页上面元素很少,目的就是模拟鼠标点一下【测试】,让【测试】被选中。试了半天,就是点不上(用坐标模拟点击就可以,关键还是想用网页元素后台点击),请大大们帮忙,看看问题出在哪?
1、截图
鼠标点击后会出现虚线框。
2、网页源码:<DIV style="BACKGROUND-POSITION: -100px 0px" class=wtc>
<DIV style="WIDTH: 100%" id=tree_favorite_00 class=wti>
<DIV class="WTrow no-action"><BUTTON class="WTexpand-icon rootMinusIcon" onfocus=this.hideFocus=true;></BUTTON><SPAN class=WTicon-and-label><A id=href_00_tree_favorite class="wti-label standartTreeRow" tabIndex=-1>工作组</A><SPAN id=ext_00_tree_favorite></SPAN></SPAN></DIV>
<DIV style="DISPLAY: block; BACKGROUND-POSITION: -100px 0px" class=wtc>
<DIV style="WIDTH: 100%" id=tree_favorite_0001040500 class=wti>
<DIV style="PADDING-LEFT: 18px" class="WTrow no-action"><BUTTON class="WTexpand-icon lIcon" onfocus=this.hideFocus=true;></BUTTON><SPAN class=WTicon-and-label><A id=href_0001040500_tree_favorite class="wti-label standartTreeRow" tabIndex=-1>测试</A><SPAN id=ext_0001040500_tree_favorite></SPAN></SPAN></DIV>
</DIV></DIV></DIV></DIV></DIV>3、程序源码:
#include<ie.au3>
$oIE = _IEAttach ("C:\Documents and Settings\Administrator\桌面\qq.htm - Windows Internet Explorer","DialogBox")
If($oIE<>0) then
$oLinks = _IETagNameGetCollection($oIE, "A")
For $oLink In $oLinks
if (StringInStr($oLink.innerText,"测试")>0) Then
msgbox(0,"ww",$oLink.innerText)
$oLink.click
endif
Next
endif
获取【span】、【div】点击也都试过,就是点不上,郁闷。。。
#include<ie.au3>
$oIE = _IEAttach("", "instance")
_IELinkClickByText($oIE, "测试")
Local $oElements = _IETagNameAllGetCollection($oIE)
Sleep(4000)
For $oElement In $oElements
ConsoleWrite($oElement.tagname & @CRLF)
If $oElement.tagname = "A" Then
_IEAction($oElement, "focus")
ToolTip("Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
Sleep(1000)
EndIf
Next
$oLinks = _IETagNameGetCollection($oIE, "A")
For $oLink In $oLinks
If (StringInStr($oLink.innerText, "测试") > 0) Then
$oLink.focus
MsgBox(0, "ww", $oLink.innerText)
EndIf
Next
回复 3# 骗子
谢谢啦! 回复 3# 骗子
骗子 帮看下这个原码
<!--/mainPart--></TD></TR></TBODY></TABLE>
<SCRIPT language=javascript src="js/sys.js"></SCRIPT>
<SPAN id=dialogCase>
<DIV style="Z-INDEX: 10001; POSITION: absolute; FILTER: alpha(opacity=40); BACKGROUND-COLOR: #eeeeee; WIDTH: 100%; HEIGHT: 845px; TOP: 0px; LEFT: 0px; opacity: 0.4" id=dialogBoxBG></DIV>
<DIV style="Z-INDEX: 10003; BORDER-BOTTOM: #2572e6 1px solid; POSITION: absolute; BORDER-LEFT: #2572e6 1px solid; WIDTH: 300px; BORDER-TOP: #2572e6 1px solid; TOP: 213px; BORDER-RIGHT: #2572e6 1px solid; LEFT: 289px" id=dialogBox>
<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff>
<TBODY>
<TR style="BACKGROUND: url(/img_client/default/bg_button_blue.gif) #2572e6 repeat-x 0px 0px" height=24>
<TD>
<TABLE style="HEIGHT: 24px; -moz-user-select: none" border=0 cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD height=24 width=6></TD>
<TD style="COLOR: #ffffff; FONT-SIZE: 14px; CURSOR: move; FONT-WEIGHT: bold" id=dialogBoxTitle>系统提示 </TD>
<TD id=dialogClose vAlign=center width=20 align=right><INPUT id=dialogBoxClose class=btn_cancel align=absMiddle width=16 height=16 type=button></TD>
<TD width=6></TD></TR></TBODY></TABLE></TD></TR>
<TR style="HEIGHT: 60px" vAlign=top>
<TD style="POSITION: relative" id=dialogBody>
<DIV style="TEXT-ALIGN: center; WIDTH: 100%; HEIGHT: 100%">
<DIV style="LINE-HEIGHT: 20px; MARGIN: 20px 20px 0px; COLOR: #000000; FONT-SIZE: 14px">内容含有关键字:日本</DIV>
<DIV style="MARGIN: 20px"><INPUT id=dialogYES class=btn value="确定" type=button></DIV></DIV></TD></TR></TBODY></TABLE></DIV>
<DIV style="Z-INDEX: 10001; POSITION: absolute; FILTER: alpha(opacity=20); WIDTH: 300px; BACKGROUND: #000; HEIGHT: 130px; TOP: 217px; LEFT: 293px; opacity: 0.2" id=dialogBoxShadow></DIV></SPAN></BODY></HTML>
我要点击确定按钮啥写。 回复 5# biwfmm
<INPUT id=dialogYES class=btn value="确定" type=button>
有ID的东西应该容易写吧,试试网页快捕的自动生成
页:
[1]