Forum Discussion

nam1's avatar
nam1
New Contributor
7 years ago

How to perform click operation, if i am fetching the locator from excel file?

I am getting the excel object (Which contains the locater). But not getting the click option to perform click operation. Please help me on this.

 

  • You need to convert the contents of "a" into something that corresponds to an onscreen object.  The screenshots you provided me give the text value of the field... and that is a string... you can't "click" on a string, so you need to convert that to an actual object. The below code should do what you want.

     

    var objectToClick = eval(a.Text)
    objectToClick.Click()

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    "a" in your code is simply the contents of cell B4 in your excel data.  That is not going to actually be a clickable object.

     

    What is the contents of that cell?  If you can give us that information, we might be able to help you figure out the best code to use to click on what you want.

  • nam1's avatar
    nam1
    New Contributor

    Hi, Thank u for reply..

     

    ''a" contains the locator of the button and i want to perform click operation. 

    Below is the attachment for "a" object in watch list. It is showing excel object. Please let me know if any other details required.

     

     

    Regards,

    Namrata

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      You need to convert the contents of "a" into something that corresponds to an onscreen object.  The screenshots you provided me give the text value of the field... and that is a string... you can't "click" on a string, so you need to convert that to an actual object. The below code should do what you want.

       

      var objectToClick = eval(a.Text)
      objectToClick.Click()

       

  • nam1's avatar
    nam1
    New Contributor

    Hi, Thanks alot. It works. :smileyhappy: