Failed To Perform Action On Blocked Control Exception? Using Coded UI? -


i automating wpf application, when record "wpfcombobox" control , performed select index on control throwing error "failed perform action on blocked control exception". please me on come problem.

wpfcontrol customcontr = new wpfcontrol(subdvnmap.subdvsnitemcustom.subdvsnitemtablist.subdvsnpiprismprismextensiotabpage); customcontr.searchproperties.add(wpfcontrol.propertynames.automationid, "legalformatscontrol");  wpfcombobox comblegal = new wpfcombobox(customcontr);        comblegal.searchproperties.add(wpfcombobox.propertynames.automationid, "legalformats"); comblegal.find(); comblegal.selectedindex = 2;  

the above code, throwing error @ comblegal.selectedindex =2

enter image description here

the reason issue:

control placed inside invisible control placed inside parent control. in code, comblegal combobox inside customcontr wpfcontrol. there control blocks accessing combobox. designers must have used other purposes while debugging, , forgotten remove after have done it.

the possible solutions:


1. try accessing invisible control parent.

wpfcontrol customcontr = new wpfcontrol(subdvnmap.subdvsnitemcustom......); customcontr.searchproperties.add(....automationid, "legalformatscontrol"); foreach(wpfcontrol tempcontr in customcontr.getchildren()) {   wpfcontrol childcontr = tempcontr.getchildren().elementat(0);   if(childcontr wpfcombobox)     {      comblegal.selectedindex = 2;      break;     } } 



2. try accessing control checking width.

wpfcontrol customcontr = new wpfcontrol(subdvnmap.subdvsnitemcustom......); customcontr.searchproperties.add(....automationid, "legalformatscontrol"); foreach(wpfcontrol tempcontr in customcontr.getchildren()) {    if(tempcontr.boundingrectangle.width>0)       {         comblegal.selectedindex = 2;         break;       } } 



3. try accessing control checking parent's width.

  wpfcontrol customcontr = new wpfcontrol(subdvnmap.subdvsnitemcustom......);     customcontr.searchproperties.add(....automationid, "legalformatscontrol");     foreach(wpfcontrol tempcontr in customcontr.getchildren())     {        if(tempcontr.boundingrectangle.width>0)          {            wpfcontrolcollection collection = tempcontr.getchildren();            foreach(wpfcontrol comblegal in collection)              {                if(comblegal wpfcombobox)                  {                   comblegal.selectedindex = 2;                    break;                  }              }          }     } 


one of these should resolve issue. if not, comment below, shall give more attempts. luck..!!


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -