Forum Discussion

fernando_miguel's avatar
fernando_miguel
Occasional Contributor
10 years ago

Firefox crashes while recording click on PopUpMenuButton

When we record a click on a mx:PopUpMenuButton Firefox always crashes.



Problem occurs at least in following versions of TC/Firefox we have tried:

* FF 27.0.1, 30.0.0

* Adobe Flash Debug 11-14

* TC 10.10, 10.30



Our PopUpMenuButton is defined like this:




<mx:PopUpMenuButton id="popUpButton"


label="{resourceManager.getString('events_rb', 'options')}"


dataProvider="{menuProvider}"


labelField="label"


includeInLayout="{model.operation == CRUDUtils.CONSULT}"


visible="{model.operation == CRUDUtils.CONSULT}"


styleName="colorizedPopUpButton"


click="this.popUpButton.open();"/>




We use an ArrayCollection as data provider for this object:




<s:ArrayCollection id="menuProvider">


<!--<fx:Object operId="{EventsModel.ACTION_REFRESH}" label="{resourceManager.getString('events_rb', 'refreshEvent')}"/> --> 


<fx:Object operId="{CRUDUtils.MODIFY}" label="{resourceManager.getString('events_rb', 'editEvent')}" />


<fx:Object operId="{CRUDUtils.DUPLICATE}" label="{resourceManager.getString('events_rb', 'copyEvent')}"/>


</s:ArrayCollection>




This array collection is modified according to the view so we add/remove more "Object" options to "menuProvider" (that occurs during initialization of the view).



We have also tried skipping recording and using the script provided here without luck: http://smartbear.com/forums/f78/fp5/t65047/how-to-select-specfic-popupmenubutton-using-te/ (we converted it to JScript):




function ClickPopUpMenuItem(PopUpMenuButton, ItemText) {


 


  PopUpMenuButton.Click(PopUpMenuButton.Width-5, PopUpMenuButton.Height/2);


 


  var AppObject, ItemObject, PropNames, PropValues;


 


  // Obtain the Flex application object


 


  AppObject = PopUpMenuButton.Parent;


 


  while (AppObject.ObjectType == "Object")


  {


    AppObject = AppObject.Parent


  }


 


  // Find a pop-up menu item by text


 


  PropNames  = new Array("ObjectType", "FlexObject.listData.label");


 


  PropValues = new Array("MenuItemRenderer", ItemText);


 


  ItemObject = AppObject.FindChild(PropNames, PropValues, 5);


 


  if(ItemObject.Exists) {


    ItemObject.Click();


  } else {


    Log.Error("PopUpMenuButton item '" + ItemText + "' was not found.");


  }


}



The problem seems to be TC not recognizing the items of the button since the script always fails at line (no matter which text option we provide):




    Log.Error("PopUpMenuButton item '" + ItemText + "' was not found.");


 

What can we do?

 




2 Replies

  • fernando_miguel's avatar
    fernando_miguel
    Occasional Contributor
    I managed to get the the ClickPopUpMenuItem() working as a workaround.



    The key was:

    * Keep it menu opened using "open()" instead of "Click()".

    * Change root object to search.



    However Firefox keeps crashing and I think that BUG should be solved anyway.



    Resulting ClickPopUpMenuItem() stays as follows:





    function ClickPopUpMenuItem(PopUpMenuButton, ItemText) {

      var AppObject, ItemObject, PropNames, PropValues;



      //PopUpMenuButton.Click(PopUpMenuButton.Width-5, PopUpMenuButton.Height/2);

      //Instead of clicking we call open that leaves the popup control opened even

      //if focus is lost (e.g. when stepping).

      PopUpMenuButton.FlexObject.open();



      // Obtain the Flex application object

     

      AppObject = PopUpMenuButton.Parent;



      // Example was looking for first parent not being an object but we

      // need just the opposite, we need it to be an object

      while (AppObject.ObjectType != "Object")

      {

        AppObject = AppObject.Parent

      }

     

      // Find a pop-up menu item by text

     

      PropNames  = new Array("ObjectType", "FlexObject.listData.label");

     

      PropValues = new Array("MenuItemRenderer", ItemText);

     

      ItemObject = AppObject.FindChild(PropNames, PropValues, 5);

     

      if(ItemObject.Exists) {

        //PopUp menu is automatically closed when clicking on an item

        ItemObject.Click();

      } else {

        //We leave the menu closed

        PopUpMenuButton.FlexObject.close();

        Log.Error("PopUpMenuButton item '" + ItemText + "' was not found.");

      }

    }