Forum Discussion

Nimeshika's avatar
Nimeshika
Contributor
9 years ago

Click an object using FullName property

Hello,

    I have a panel with wndClass : WindowsForms10.Window.8.app.0.378734a_r49_ad1

 

It has two items in its list namely

Auto1

address : Sys.Process("FileMaintenance").WinFormsObject("frmSuperbill").WinFormsObject("panelMain").WinFormsObject("ctrlHeading-331").WinFormsObject("panelMain").WinFormsObject("lblDescription")

and

Auto2

 

 address : Sys.Process("FileMaintenance").WinFormsObject("frmSuperbill").WinFormsObject("panelMain").WinFormsObject("ctrlHeading-338").WinFormsObject("panelMain").WinFormsObject("lblDescription")

 

The number in red keeps changing.

I need to click on Auto 2, Text recognition did not work. 

 

I used the following logic:

 function ClickAuto()

{

a= Sys.Process("FileMaintenance").WinFormsObject("frmSuperbill").WinFormsObject("panelMain").WinFormsObject("ctrlHeading-*").WinFormsObject("panelMain").WinFormsObject("lblDescription")

 

if(a.Text == "Auto2")

b= a.FullName      //b holds the FullName of the object with name Auto2

b.Click()  //Click is not supported

}

 

 

HOW CAN I PERFORM CLICK OPERATION by using the FULL NAME property?

 

 

Thanks in advance,

 

   Nimeshika

 

 

2 Replies

  • Gan's avatar
    Gan
    Occasional Contributor

    Hi,

       you can use X=GetPropertyvalue(objectName,"Text") take object property value then you can perform an action on Particuler object.

     

     

    Thanks,

    Gan

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      You have set variable "b" to be the FullName property of the object stored in variable "a".

       

      You then try and apply a Click to "b". This won't work. "b" is a property (text string), not an object.

       

      Just apply the click to "a" instead? You check the text of "a". If the text is the value you want, you then extract the fullname of "a" to try and click it. So it's "a" you want to click in the first place (if the condition matches). You don't need "b" as far as I can tell?

       

      So instead of:

       

      if(a.Text == "Auto2")

      b= a.FullName      //b holds the FullName of the object with name Auto2

      b.Click()  //Click is not supported

       

      Just have:

       

      if(a.Text == "Auto2")

      a.Click()