使用QTP的过程中可能会遇到需要批量选中网页中的CheckBox,大致如下图:

  QTP 如何批量选中网页中的CheckBox

  具体代码如下:

Call CheckAllBox
Function CheckAllBox
	Set BrowserDesc = Browser("micclass:=Browser")
	Set PageDesc = BrowserDesc.Page("micclass:=Page")
	Set CheckBoxDesc = Description.Create
	CheckBoxDesc("micClass").value = "WebCheckBox"
	Set CheckBoxList = PageDesc.ChildObjects(CheckBoxDesc)
	If CheckBoxList.count > 0 Then
		For i = 0  To CheckBoxList.count - 1
			CheckBoxList(i).click
		Next
	Else
		Msgbox "抱歉!您当前页面不存在 WebCheckBox 对象!"
	End If
End Function

 

  运行代码的效果图如下:

  QTP 如何批量选中网页中的CheckBox

相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2021-12-18
  • 2021-12-02
  • 2022-01-11
  • 2021-11-17
猜你喜欢
  • 2021-06-21
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2021-05-26
相关资源
相似解决方案