|
参考一下我框架中的两个方法,希望对你有帮助
获取对象坐标
'用于解决弹出页面后无法识别对象
Function GetErrElement(value)
x1=Browser("title:="&Environment("BrowserTitle")).Page("title:="&Environment("PageTitle")).GetROProperty("abs_x")
y1=Browser("title:="&Environment("BrowserTitle")).Page("title:="&Environment("PageTitle")).GetROProperty("abs_y")
str1=PortfolioStr (Environment("BrowserTitle"),Environment("PageTitle"),datavalue("frameid",value),datavalue("元素类型",value),datavalue("元素属性",value),datavalue("Index",value),"GetROProperty","abs_x")
x2=Eval(str1)
str2=PortfolioStr (Environment("BrowserTitle"),Environment("PageTitle"),datavalue("frameid",value),datavalue("元素类型",value),datavalue("元素属性",value),datavalue("Index",value),"GetROProperty","abs_y")
y2=Eval(str2)
Environment("ErrElement_X")=x2-x1
Environment("ErrElement_y")=y2-y1
End Function
'点击指定坐标
Function ClickErrElement(value)
p_x=datavalue("X坐标偏移",value)
p_y=datavalue("y坐标偏移",value)
If p_x="" Then
p_x=0
End If
If p_y="" Then
p_y=0
End If
x=CInt(p_x)+CInt (Environment("ErrElement_X"))
y=CInt(p_y)+CInt (Environment("ErrElement_y"))
Window("RegExpWndTitle:=Windows Internet Explorer|Microsoft Internet Explorer","RegExpWndClass:=IEFrame").WinObject("RegExpWndClass:=Internet Explorer_Server").click x,y
End Function |
|