找回密码
 加入
搜索
查看: 6563|回复: 10

[IE类操作] 【已解决】AU3怎么实现点击JS页面选择框

  [复制链接]
发表于 2013-1-8 15:17:47 | 显示全部楼层 |阅读模式
本帖最后由 491623644 于 2013-1-9 09:40 编辑
<h3>步骤2:选择送货地址</h3></div><div class="pbSubsection"><table class="detailList" border="0" cellpadding="0" cellspacing="0"><tr><td class="data2Col  first " colSpan="2"><table class="list " id="j_id0:j_id2:pb:address:Address" border="0" cellpadding="0" cellspacing="0"><colgroup span="10"></colgroup><thead class="rich-table-thead"><tr class="headerRow "><th class="headerRow  " scope="col" colspan="1" id="j_id0:j_id2:pb:address:Address:colSelectheader"><div id="j_id0:j_id2:pb:address:Address:colSelectheader:sortDiv">选择</div></th><th class="headerRow  " scope="col" colspan="1" id="j_id0:j_id2:pb:address:Address:j_id34header"><div id="j_id0:j_id2:pb:address:Address:j_id34header:sortDiv">城市名称</div></th><th class="headerRow  " scope="col" colspan="1" id="j_id0:j_id2:pb:address:Address:j_id35header"><div id="j_id0:j_id2:pb:address:Address:j_id35header:sortDiv">送货地址代码</div></th><th class="headerRow  " scope="col" colspan="1" id="j_id0:j_id2:pb:address:Address:j_id36header"><div id="j_id0:j_id2:pb:address:Address:j_id36header:sortDiv">地址</div></th></tr></thead><tbody id="j_id0:j_id2:pb:address:Address:tb"><tr class="dataRow even  first " onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onBlur="if (window.hiOff){hiOff(this);}" onFocus="if (window.hiOn){hiOn(this);}"><td class="dataCell  " id="j_id0:j_id2:pb:address:Address:0:colSelect" colspan="1" width="1px"><input id="j_id0:j_id2:pb:address:Address:0:chkSelect" type="checkbox" name="j_id0:j_id2:pb:address:Address:0:chkSelect" onchange="A4J.AJAX.Submit('j_id0:j_id2',event,{'similarityGroupingId':'j_id0:j_id2:pb:address:Address:0:j_id33','parameters':{'j_id0:j_id2:pb:address:Address:0:j_id33':'j_id0:j_id2:pb:address:Address:0:j_id33'} } )" /></td><td class="dataCell  " id="j_id0:j_id2:pb:address:Address:0:j_id34" colspan="1">泸州</td><td class="dataCell  " id="j_id0:j_id2:pb:address:Address:0:j_id35" colspan="1">1123988</td><td class="dataCell  " id="j_id0:j_id2:pb:address:Address:0:j_id36" colspan="1">泸州市杜家街紫荆苑A幢</td></tr><tr class=" dataRow odd " onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onBlur="if (window.hiOff){hiOff(this);}" onFocus="if (window.hiOn){hiOn(this);}"><td class="dataCell  " id="j_id0:j_id2:pb:address:Address:1:colSelect" colspan="1" width="1px">
HTML代码如上所示,其中有一句:input id="j_id0:j_id2:pb:address:Address:0:chkSelect" type="checkbox" name="j_id0:j_id2:pb:address:Address:0:chkSelect" 为一个选择框,需要点击该选择框,使用autoit应该怎么去操作?谢谢!
 楼主| 发表于 2013-1-8 15:19:23 | 显示全部楼层
本帖最后由 491623644 于 2013-1-8 15:20 编辑
Func js($script)
        $oIE.document.parentWindow.execscript($script)
EndFunc
js(FileRead("jquery-1.6.1.min.js"))
        js("$('#j_id0:j_id2:pb:address:Address:0:chkSelect').click()")
使用这种方法的时候,系统运行没有反应(选择框没有勾选),请各位指点!
发表于 2013-1-8 16:01:34 | 显示全部楼层
type="checkbox" 你去点击可定不行啊
$oItem = _IEGetObjById($oIE, "j_id0:j_id2:pb:address:Address:0:chkSelect")
$oItem.checked = True
$oItem.fireEvent("onChange")
$oItem.fireEvent("OnClick")
发表于 2013-1-8 16:04:34 | 显示全部楼层
回复 2# 491623644

几乎可以肯定是里面冒号引起的问题(你的Js代码没错,将其中的冒号去掉就可以),因为通过AU3来调用jQuery的话,有可能会在处理多个双引号及":"等出现些问题,建议直接使用IEUDF或者风行者坛友的网页快捕
 楼主| 发表于 2013-1-8 17:38:25 | 显示全部楼层
回复 3# komaau3
直接用IEGetObjById是不能获取到ID的吧?
发表于 2013-1-8 22:38:03 | 显示全部楼层
回复 3# komaau3

方法不错,不过应该不是这个原因,直接使用_IE**函数,用click是可以的,楼主用了jQuery,但jQuery里好像没有FireEvent(好像是用另外的事件触发方式了,不太熟)
原因应该是JQ在处理单双引号及":"时出问题了删除了冒号离线测试可行~~
发表于 2013-1-8 22:48:32 | 显示全部楼层
真想不到,还有求助也审核的~~开眼界了
 楼主| 发表于 2013-1-8 22:53:40 | 显示全部楼层
回复 4# annybaby


    谢谢!已使用网页快捕,很好用!
发表于 2013-1-8 23:44:37 | 显示全部楼层
遍历控件,得到你想要的控件;或者直接从源码中查找控件id。
发表于 2013-1-9 02:25:47 | 显示全部楼层
学习了~~~~~~~~
发表于 2013-1-9 02:26:26 | 显示全部楼层
网页快捕,我也去下载一个试试
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-15 23:28 , Processed in 0.076557 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表