Forum Discussion

ArmandsBruns's avatar
ArmandsBruns
Frequent Contributor
13 years ago

Function (Find Object in NameMapping)

Hi,






Maybe someone can help me – why doesn't find the object in NameMapping



------------------------------------------------

Function FindObject(location, ObjectTypeValue, inerrTextValue)

  location.RefreshMappingInfo

  location.Refresh

  Dim location1

  Dim arrProp, arrVal

  ObjectTypeValue = Value1

  inerrTextValue = Value2

  arrProp = Array("ObjectType", "inerrText")

  arrVal = Array(Value1, Value2)

  Set location1 = location.FindChild(arrProp, arrVal)

    If location1.Exists Then

      Log.message("Object - Exists")    

      Call location1.Click

      Call page.Wait

    Else

  For a = 1 To 50

  location.RefreshMappingInfo

  location.Refresh

  ObjectTypeValue = Value1

  inerrTextValue = Value2

  arrProp = Array("ObjectType", "inerrText")

  arrVal = Array(Value1, Value2)

  Set location1 = location.FindChild(arrProp, arrVal)

      Call location1.Click

      Call page.Wait

        If FindObject = True Then

          Exit For

        End If

     Next

  End If

End Function

---------------------------------------------



Armands
  • Hi,

    Could you please check the name of the second object property you have specified in your function? I guess, it must be "innerText" instead of "inerrText".



    Thanks in advance.

    Ann
  • Hi,


    As far as I can see, you try to pass Value1 and Value2 to the arrVal array. But the Value1 and Value2 variables

    are not defined in your script code, that is, the arrVal array will be empty.


    Try to correct the following code:


    ObjectTypeValue = Value1

       inerrTextValue = Value2

     


    to


    Value1 = ObjectTypeValue

       Value2 = inerrTextValue

     


    I hope this helps.

    Ann