Forum Discussion

jyothi_kumari's avatar
jyothi_kumari
New Contributor
10 years ago

Call to PerformClick method on Dotnet toolbar object stops execution.

I am calling "PerformClick" method on the DotNet tool bar object (class: WindowsForms10.Window.8.app.0.ea7f4a_r13_ad1), but it stops execution since this method doesn't return till I close the window which opened after clicking on toolbar button. To open the same window I can select a menu item or type the shortcut key, with these two methods execution doesn't go to unresponsive state, but when I click on the toolbar item execution stops. I have read the article “Testing Modal Windows - http://support.smartbear.com/viewarticle/55107/" and tried calling "Runner.CallObjectMethodAsync(object, “PerformClick”)" method and it works fine without stopping execution. But I would like to know why call for "PerformClick" method stops execution if there is no issue with the window being opened after clicking on the button as we are not facing this issue when we tried to open the same window by menu selection and by using shortcut key. Could you please help me in understanding the same? Or is there any generic way to identify the appearance of modal window on clicking the toolbar button so that we can avoid execution going to unresponsive state.

5 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Jyothi,


     


    PerformClick is a native method of the control. Try using TestComplete's actions instead of it. For example, ClickItem or Click. Do you see the difference?


     

    • qtrolazyg's avatar
      qtrolazyg
      Contributor

      I'm having a simlar issue.  The PerformClick clicks the button on the toolstrip, but I cannot perform any actions on the modal window.  Click and ClickItem produce "Object doesn't support this property or method".  So far the PerformClick is the only thing that clicks the button.  Ideas?

      .Net app

      TC 11.06

       This is my experiment:

       

      for (var idxButton = 0; idxButton <= numberButtons; idxButton++) {

        if(toolbar.Items.Item(idxButton).Name == buttonName) {
          Log.Message("index is ==> " + idxButton);
          Log.Message("button is " + toolbar.Items.Item(idxButton).Name);
          toolbar.Items.Item(idxButton).PerformClick();  //modal window opens and then stops resonding
        }
      }

       

      **edit**

      I've been pondering what Ryan and Tanya discussed on this topic and then light dawned!  I made the following adjustment and all was well.

        toolbar.Items.Item(idxButton).PerformClick();

        Runner.CallObjectMethodAsync(toolbar.Items.Item(idxButton),"PerformClick");

  • Hi Tanya,



    "ClickItem" is not supported for this control, could you please let me know if there is any other way to perform click operation on this control.



    Thanks,

    Jyothi
  • Hi Tanya,



    I have few more queries, please find them below.



    1. Since we have many scripts, we need to call "PerformClick" asynchronously in all places where we find this issue. So could you please let me know if there are any project level properties which can be set to handle/identify the modal windows which may appear on call to "PerformClick" method?



    2. I am unable to access the object and call click method on the object. Object class is WindowsForms10.Window.8.app.0.ea7f4a_r13_ad1. I am trying to use the object as "Set object = Toolbar.Items.Item_2(index)" and then trying to call "object.Click", but it is not working. Please let me know if I am missing something in the way I am trying to access the object.



    3. In the example given in the article http://support.smartbear.com/viewarticle/8922/ (How can I close a modal dialog which was invoked by a method called from a script?), code checks for the "ResObject.Completed" status and logs messages accordingly. So when we call Runner.CallObjectMethodAsync() method is it necessary to check for the completed status of method called asynchronously or can we proceed with script execution without making this check. Please let me know the importance of checking completed status in result object.



    Could you please help me finding answers for these queries.



    Thanks,

    Jyothi

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    I believe what you want is Object.ClickItem(index) once you have found the correct index for the item in the Object.Items.Item_2 collection.