找回密码
 加入
搜索
查看: 1914|回复: 1

[AU3基础] 请高手指点下

  [复制链接]
发表于 2011-1-30 12:26:29 | 显示全部楼层 |阅读模式
请问下这个网页里面的一个checkbox这么让它点指定的ID,看了帮助里面的例子好像不适用这个网页!
http://www.ijiangyin.com/dcms/vote/2.html
; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, select and
;                                deselect the checkboxes byValue.  Since $s_Name is not specified, operate
;                                on the collection of all <input type=checkbox> elements in the form
;                                Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
        _IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 1, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 1, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 1, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 1, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 0, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 0, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 0, "byValue")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 0, "byValue")
        Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, select and
;                                deselect the checkboxes byIndex.  Since $s_Name is not specified, operate
;                                on the collection of all <input type=checkbox> elements in the form
;                                Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
        _IEFormElementCheckboxSelect ($oForm, 3, "", 1, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 2, "", 1, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 1, "", 1, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 0, "", 1, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 3, "", 0, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 2, "", 0, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 1, "", 0, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 0, "", 0, "byIndex")
        Sleep(1000)
Next

; *******************************************************
; Example 3 - Open a browser with the form example, get reference to form, select and
;                                deselect the checkboxes byIndex in the group that shares the name checkboxG2Example
;                                Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
        _IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 1, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 1, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 0, "byIndex")
        Sleep(1000)
        _IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 0, "byIndex")
        Sleep(1000)
Next
发表于 2011-1-31 12:47:12 | 显示全部楼层

#include <IE.au3>

$oIE = _IECreate("http://www.ijiangyin.com/dcms/vote/2.html")
$oCheckbox = _IEGetObjById($oIE,"1")
$oCheckbox.checked = True


btw:江阴的啊,也算是老乡,呵呵
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 12:27 , Processed in 0.194483 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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