autoit3 ie.au3 函数之——_IEFormElementCheckBoxSelect & _IEFormGetObjByName
2011-11-16 15:37
363 查看
_IEFormElementCheckBoxSelect:Set the value of a specified form element.
设定一个指定表单元素的值(Checkbox).
#include <IE.au3>
_IEFormElementCheckBoxSelect ( ByRef $o_object, $s_string [, $s_name = "" [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]]] )
Parameters
_IEFormGetObjByName:
Returns an object reference to a Form by name.
返回一个指定名称的表单对象.
#include <IE.au3>
_IEFormGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )
Parameters
例子: 打开一个带有form的网页,然后获取form的接口,选择并取消checkbox的值。执行5边以供参考。此处是利用的byValue
; *******************************************************
; 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
例子: 首先获取form对象, 然后获取form里面的输入框,设置此输入框的值, 然后提交form对象。
; *******************************************************
; Example 1 - Get a reference to a specific form by name. In this case, submit a query
; to the Google search engine. Note that the names of the form and form
; elements can be found by viewing the page HTML source
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)
例子:打开一个带有form的网页,然后获取form的接口,选择并取消checkbox的值。执行5边以供参考。此处是利用的byIndex;
;*******************************************************
; 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
设定一个指定表单元素的值(Checkbox).
#include <IE.au3>
_IEFormElementCheckBoxSelect ( ByRef $o_object, $s_string [, $s_name = "" [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]]] )
Parameters
$o_object | Object variable of an InternetExplorer.Application, Form object |
$s_string | Value used to match element - treatment based on $s_mode |
$s_name | [optional] Name or Id of checkbox(es) |
$f_select | [optional] specifies whether element should be checked or unchecked -1 = Return checked state 0 = Uncheck the element 1 = (Default) Check the element |
$s_mode | [optional] specify search mode byValue = (Default) value of the checkbox you wish to select byIndex = 0-based index of checkbox you wish to select |
$f_fireEvent | [optional] specifies whether to fire OnChange and OnClick events after changing value 0 = do not fire OnChange or OnClick event after setting value 1 = (Default) fire OnChange and OnClick events after setting value |
Returns an object reference to a Form by name.
返回一个指定名称的表单对象.
#include <IE.au3>
_IEFormGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )
Parameters
$o_object | Object variable of an InternetExplorer.Application, Window or Frame object |
$s_name | Specifies the name of the Form you wish to match |
$i_index | [optional] If Form name occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified Forms |
; *******************************************************
; 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
例子: 首先获取form对象, 然后获取form里面的输入框,设置此输入框的值, 然后提交form对象。
; *******************************************************
; Example 1 - Get a reference to a specific form by name. In this case, submit a query
; to the Google search engine. Note that the names of the form and form
; elements can be found by viewing the page HTML source
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)
例子:打开一个带有form的网页,然后获取form的接口,选择并取消checkbox的值。执行5边以供参考。此处是利用的byIndex;
;*******************************************************
; 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
相关文章推荐
- autoit3 ie.au3 函数之——_IEFormElementGetCollection & _IEFormGetCollection
- autoit3 ie.au3 函数之——_IEGetObjById、_IEGetObjByName
- JS中:关于form中的Checkbox的操作: document.getElementsByName("name"),如何取消选中状态,如何将文本框内容清空
- document.getElementsByName & document.getElementById 在IE与FF中不同实现
- autoit3 ie.au3 函数之——_IEErrorHandlerDeRegister & _IEErrorHandlerRegister
- document.getElementsByName和document.getElementById 在IE与FF中不同实现
- getElementByID&nbsp;getElementsByName…
- IE中document.getElementById()对name和id的读取
- ie的大问题,关于document。getElementById和getElementsByName
- autoit3 ie.au3 函数之——_FileWriteLog日志
- getElementByClassName封装函数用法
- autoit3 ie.au3 函数之——_IEDocInsertHTML
- document.getElementsByName和document.getElementById 在IE与FF中不同实现
- autoit3 ie.au3 函数之——_IEBodyReadHTML、_IEBodyWriteHTML
- autoit3 ie.au3 函数之——_IECreateEmbedded
- autoit3 ie.au3 函数之——_IEBodyReadText
- autoit3 ie.au3 函数之——_IEErrorNotify
- jquery 根据name属性获取对象(=document.getElementByName("") )
- document.getElementById("form1").username.focus();
- 解决多线程中spInputElement.GetPropertyByName( L"name", &vName )导致崩溃