05-16-2008, 05:11 PM
Hi, can anyone help me with my script?
I have function and procedure. In both of them I describe the same object, but when I call function in procedure I recive an error.
Here is script:
I have function and procedure. In both of them I describe the same object, but when I call function in procedure I recive an error.
Here is script:
Code:
Function SectionButtonExist (Section, Button)
Dim oDesc, Sect, oImg
SectionButtonExist = False
Set oClass=Description.Create()
oclass("micclass").value="WebTable"
oclass("innertext").value = ".*" & Section & " .*"
Set Sect = Browser(“Browser”).Page(“Page”).childObjects(oClass)
If Sect.Count>0 Then
Set Section = Sect(0)
Set oClass=Description.Create()
oclass("micclass").value="Image"
oclass("html tag").value="IMG"
oclass("alt").value= Button
Set oImg = Section.childObjects(oClass)
If oImg.Count >0 Then
SectionButtonExist = True
Else
SectionButtonExist = False
End If
Else
SectionButtonExist = False
End If
End Function
Sub ClickButton (Section, Button)
Dim oDesc, Sect, oImg
Set oClass=Description.Create()
oclass("micclass").value="WebTable"
oclass("innertext").value = ".*" & Section & " .*"
Set Sect = Browser(“Browser”).Page(“Page”).childObjects(oClass)
If Sect.Count>0 Then
Set Section = Sect(0)
Set oClass=Description.Create()
oclass("micclass").value="Image"
oclass("html tag").value="IMG"
oclass("alt").value= Button
Set oImg = Section.childObjects(oClass)
If SectionButtonExist (Section, Button) Then
If oImg.Count >0 Then
oImg(0).Click
End If
End If
End If
End Sub