Forum Discussion

jon_yates's avatar
jon_yates
Occasional Contributor
11 years ago

Why does this error?

Hello all.



Within a webpage I'm forcing some validation and checking for its presence:




var text = page["NativeWebObject"]["Find"]("contentText", "The Name already exists*", "span");




if(text["Enabled"])


  {


    Aliases["browser"]["page1921680200"]["panelBody"]["section"]["Panel"](0)["Panel"](3)["Panel"](1)["Click"](20,20);


  }


  else


  {


    Aliases["browser"]["page1921680200"]["panelBody"]["section"]["frame"]["panelContent"]["panelWidgetContext"]["panel2"]["panel"]["Click"](26, 30);


  }



If this appears, I want to click a different button to that if there's no validation.



Everythig works except for the bold text (i,.e when there is no validation errors).



I used the object spy to identify the control but when it runs it errors with the below, can anyone please help why?




You are trying to call the "panel" method or property of the following name mapping object:










Name mapping item:

section




The test engine is unable to call this method (or property), because the object has a child object whose name coincides with the method's (or property's) name.





To call this method (property), you need to first obtain a reference to the underlying test object with the GetUnderlyingObject() method.





2 Replies

  • Hi Jon,

     


    Let me quote the "GetUnderlyingObject Method" article:


    After you map a test object, its methods, properties and child objects become accessible through the Alias or NameMapping item that corresponds to this test object. It is possible that the Alias or NameMapping item has a child item, whose name coincides with a method or property name of the underlying test object



     


    Did you try using the GetUnderlyingObject method in your code?


     

  • jon_yates's avatar
    jon_yates
    Occasional Contributor
    Hi Tanya.



    Thanks for the response.



    I haven't tried. I'll take a look at the link and try it again.



    Thanks.