Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DP - redescription
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
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:

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
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
I think you have to declare function as Public.

Regards
Sridhar
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Thank you. I already find a mistake by myself Rolleyes. I assaigned two object the same name.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)