Forum Discussion

lokithorshield's avatar
lokithorshield
Contributor
10 years ago

Click not working

Hi all, Urgent help needed.

 

I am trying to do a Click() Action on an object. While manual click does work on this button  [Exports a excel to desktop of all table items - list of historical records], the Testobj.click()  does not work on this. Can someone help

 

var snf= page.NativeWebObject.Find("title", "Export");

if ((snf.Exists))

var s1 = snf.contentText; [ LogMessage s1 dislpays = Export]

 

s1.Click();

s1.Keys([Tab][Enter]);

 

Etc - none of them works. Clicking via mouse does..

 

Help appreciated.

 

Thanks,

Mahesh

 

  • Hi,

     

    You need to call the Click method from the Export object. Currently, you are calling it from the contentText property. Here is the modified code:

    var snf= page.NativeWebObject.Find("title", "Export");
    if (snf.Exists)
    {
      var s1 = snf.contentText;// [ LogMessage s1 dislpays = Export]
      snf.Click();
    }

    Does it help?

  • lokithorshield's avatar
    lokithorshield
    10 years ago

    Hi, yes - sorry my mistake - I did click an object - instead text. its good now

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,

     

    You need to call the Click method from the Export object. Currently, you are calling it from the contentText property. Here is the modified code:

    var snf= page.NativeWebObject.Find("title", "Export");
    if (snf.Exists)
    {
      var s1 = snf.contentText;// [ LogMessage s1 dislpays = Export]
      snf.Click();
    }

    Does it help?

    • lokithorshield's avatar
      lokithorshield
      Contributor

      Hi, yes - sorry my mistake - I did click an object - instead text. its good now