"Another control is blocking the control" error after re-opening a dialog box.

Locked "Another control is blocking the control" error after re-opening a dialog box.

  • Tuesday, March 06, 2012 8:35 PM
     
     

    Greetings, colleagues:

    I have been fighting this problem for a day now.  I although I see questions and answers to many similar errors in the forums, I cannot find one that seems to fit my situation.  Here it is.

    I am running coded ui tests on a Silverlight application, written in C# using Visual Studio 2010. One test involves a dialog box with four controls: 

    • text edit box
    • text edit box
    • Save button
    • Cancel button

    The algorithm for the test is:

    • open the dialog box
    • enter a file path in the first text edit box
    • enter a file path in the second text edit box
    • click on the Save button
    • re-open the dialog box
    • verify the value in the first text edit box
    • verify the value in the second text edit box
    • CLICK ON THE CANCEL BUTTON

    This last step trigger the following exception:

    Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnBlockedControlException: Another control is blocking the control.Please make the blocked control visible and retry the action. Additional Details: 

    TechnologyName:  'Silverlight'
    ControlType:  'Button'
    AutomationId:  '1690bb3f-eac8-4a1c-aac8-e455ebc475ed'
     ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F003

    I have tried the following methods on the Cancel button:

    • uICancelButton.WaitForControlExist();
    • uICancelButton.WaitForControlExist(15000);
    • uICancelButton.WaitForControlReady();
    • uICancelButton.WaitForControlReady(15000);
    • uICancelButton.WaitForControlEnabled();
    • uICancelButton.WaitForControlEnabled(15000);
    • Playback.Wait(15000);

    None of these corrects the problem.

    There are no other windows or dialog boxes open.

    Interestingly, when I run "uICancelButton.DrawHighlight();", instead of highlighting the Cancel button, the highlighted rectangle includes all four controls.  This is certainly a clue, but I'm not wise enough to figure it out.  Can someone help me with this.

    Thanks.

    Barry


    My opinions are strictly my own. They do not reflect the positions of policies of AccessData Group LLC, or any other organized group. For that matter, they just barely reflect my OWN positions and policies!

All Replies

  • Wednesday, March 07, 2012 7:40 AM
     
     

    Hi Barry,

    I've faced similar kind of problem in WPF.
    That time I've tried the following code and worked fine for me.

    <controlName>.Find();
    Mouse.Click(<controlName>);

    In your case, controlName will replace "uICancelButton".

    Even if it is not working for the above code, try to use 'FindMatchingControls()' method along with UITestControlCollection.


    Thanks & Regards, Sasisekar J

  • Wednesday, March 07, 2012 6:38 PM
     
     Answered

    Thanks for your timely response, Sasisekar J.  

    I managed to find another solution to the problem, as follows.

    My workstation is a dual-display system.  The MSVS with Coded UI application was running on the primary display.  The target web application was running in an IE9 window (with Compatibility View enabled) on the secondary display.  Recording the test steps in this configuration somehow caused the playback problem described above.  

    When re-recorded the test steps with the target window and app on the primary display with MSVS and Coded UI, The playback worked properly.

    I have not attempted to record the steps with both apps running on the secondary display.

    Barry


    My opinions are strictly my own. They do not reflect the positions of policies of AccessData Group LLC, or any other organized group. For that matter, they just barely reflect my OWN positions and policies!

    • Marked As Answer by BarryCarroll Wednesday, March 07, 2012 6:38 PM
    •