在WEB页面中隐藏对象3种方式
1、使用display
例如:
<label />


2、使用visibility
例如:
<label />


3、使用class
例如:
<label />

 

解决办法


1、针对第一种方式


方法(1):
Set oElm = Browser("B").Page("P").WebElement("This message is hidden using CSS display property")
If oElm.object.currentStyle.display="none" Then
Msgbox "Object is hidden"
Else
Msgbox "Object is visible"
End if


方法(2):
Set oElm = Browser("B").Page("P").WebElement("This message is hidden using CSS display property")
Dim x,y, width, height
x = oElm.GetROProperty("x")
y = oElm.GetROProperty("y")
width = oElm.GetROProperty("width")
height = oElm.GetROProperty("height")
If x=0 And y=0 And width=0 And height=0 Then
Msgbox "Object is hidden"
Else
Msgbox "Object is visible"
End if


方法(3):
Set oElm = Browser("B").Page("P").WebElement("This message is hidden using CSS display property")
If InStr(oElm.GetROProperty("attribute/style"),"display:none") Then
Msgbox "Object is hidden"
Else
Msgbox "Object is visible"
End if


2、针对第二种方式
采用类似方法(1)和方法(3)来处理


3、针对第三种方式
采用类似方法(1)来处理


方法(4):
Set oElm = Browser("B").Page("P").WebElement("This message is hidden using CSS display property")
If oElm.GetROProperty("class") = "messageHidden" Then
Msgbox "Object is hidden"
Else
Msgbox "Object is visible"
End if

相关文章:

  • 2021-06-28
  • 2022-12-23
  • 2021-11-11
  • 2021-07-20
  • 2022-01-13
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-29
  • 2021-12-24
  • 2021-08-07
  • 2021-09-18
  • 2021-11-28
  • 2021-11-23
  • 2021-08-11
相关资源
相似解决方案