Forum Discussion

msalvador's avatar
msalvador
Frequent Contributor
5 years ago
Solved

click method is very slow

Hi guys,

Click method is very slow, if I debug code line stay at method click about 20 seconds.

Specially when I must click object in order to exit from a drop down menu.

The time recognitionof the object is good...

Here my function:

Property ='idStr'

Value = '<nameid>'

function Button_Click(Property,Value)
{
try
{
var btt = Sys.Browser(VarBrowser).FindChild(Property, Value, 20)
if (!btt.exists)
Log.Error("Button" + Property +" doesn't exists " + e.message)
else
btt.Click ();
Sys.Browser(VarBrowser).Page("*").Wait();
}
catch(e)
{
Log.Error("Button " + Property + " Value: " + Value + " doesn't exists " + e.message)
}
finally
{
return true
}
}

  • To check the fact that the "Click" method takes a long time, please post two timestamps to the log (before and after "Click"). You can find a sample code below.

     

    ...

    Log.Message(aqDateTime.Now());

    btt.Click ();

    Log.Message(aqDateTime.Now());

    ...

     

    If the time difference is 20 seconds indeed, you can create a support case. Most probably, we will need to reproduce this slowness in our test lab for investigation. So, please be ready to provide us with access to your website.

     

    Thank you! 

5 Replies

  • cunderw's avatar
    cunderw
    Community Hero

    My guess it that what you are clicking is very far down the object tree and it's taking a while to search for it on execution. Is there a reason you aren't using the name mapping feature to have a more direct path to your object?

    • msalvador's avatar
      msalvador
      Frequent Contributor

      Hi cunderw,

      Is not the search slow but the click method, I try to map the object with namemapping but the result still the same

  • YuriPeshekhonov's avatar
    YuriPeshekhonov
    SmartBear Alumni (Retired)

    To check the fact that the "Click" method takes a long time, please post two timestamps to the log (before and after "Click"). You can find a sample code below.

     

    ...

    Log.Message(aqDateTime.Now());

    btt.Click ();

    Log.Message(aqDateTime.Now());

    ...

     

    If the time difference is 20 seconds indeed, you can create a support case. Most probably, we will need to reproduce this slowness in our test lab for investigation. So, please be ready to provide us with access to your website.

     

    Thank you! 

    • msalvador's avatar
      msalvador
      Frequent Contributor

      Hi Yuri,

      I'll try to catch time before and after.

      Unluky I couldn't give you the access of the website.

    • msalvador's avatar
      msalvador
      Frequent Contributor

      Hi Yuri,

      I put in test click method, catching the time before and after the click method.

      Click method is not slow, it seemed slow because in debug mode the cursor stayed a long time in click row.

      But i figured out with object spy that the object wasn't visible, but it was in the tree, so I suppose that both find child and namemapping take a long time to recognize it.