本帖最后由 shano 于 2010-9-23 02:20 编辑
一表单填写一项后会自动检测合法性,但是AUTOIT填表却不能激活检测,点击提交会提示某一项无效,目前我的方法是AUTOIT提交一次焦点会选在其中一项 然后发送一个TAB离开焦点就会激活检测,连续发送6次。。汉 感觉这个方法好傻,而且发送的是TAB 会影响操作 不知道各位大侠们有没有其他高招,附上我的代码
www.king.com/signup.jsp 目标网址
$oIE1 = _IECreate ("http://www.king.com/signup.jsp",0,1,0,1)
sleep(20000)
$form = _IEFormGetObjByName($oIE1, "frmSignup");获取表单对象
TrayTip("提示","获取表单对象",10)
$oQuery = _IEFormElementGetObjByName ($Form, "username")
_IEFormElementSetValue ($oQuery,"fdsaklfjk3",0 )
$oQuery = _IEFormElementGetObjByName ($Form, "password")
_IEFormElementSetValue ($oQuery, 234234,1)
$oQuery = _IEFormElementGetObjByName ($Form, "email")
_IEFormElementSetValue ($oQuery, "fdsaklfjkl123@fdsfds.com",1)
$birthYear=Random(8,28,1)
$oQuery = _IEFormElementGetObjByName ($Form, "birthYear")
_IEFormElementOptionSelect ($oQuery , $birthYear, 1, "byIndex")
$birthMonth=Random(1,11,1)
$oQuery = _IEFormElementGetObjByName ($Form, "birthMonth")
_IEFormElementOptionSelect ($oQuery , $birthMonth, 1, "byIndex")
$birthDateDay=Random(1,30,1)
$oQuery = _IEFormElementGetObjByName ($Form, "birthDateDay")
_IEFormElementOptionSelect ($oQuery , $birthDateDay, 1, "byIndex")
_IEFormElementRadioSelect ($Form, "2","gender", 1, "byValue")
TrayTip("提示","表单填写完毕",15)
Sleep(1000)
$oSubmit=_IEGetObjById($Form,"submit")
$oSubmit.click
send("{tab}")
TrayTip("提示","第1次点击",15)
sleep(4000)
$oSubmit=_IEGetObjById($Form,"submit")
$oSubmit.click
send("{tab}")
TrayTip("提示","第3次点击",15)
sleep(4000)
$oSubmit=_IEGetObjById($Form,"submit")
$oSubmit.click
send("{tab}")
TrayTip("提示","第3次点击",15)
sleep(4000)
$oSubmit=_IEGetObjById($Form,"submit")
$oSubmit.click
send("{tab}")
TrayTip("提示","第4次点击",15)
sleep(4000)
$oSubmit=_IEGetObjById($Form,"submit")
$oSubmit.click
send("{tab}")
TrayTip("提示","第5次点击",15)
sleep(4000)
$oSubmit=_IEGetObjById($Form,"submit")
$oSubmit.click
send("{tab}")
TrayTip("提示","第6次点击",15)
sleep(4000) |