Cannot perform 'Click' on the hidden control, search by name with '-' in it
-
יום שלישי 14 אוגוסט 2012 13:47
Hi all
Mouse.Click() fails with following exception:
Message=Cannot perform 'Click' on the hidden control. Additional Details:
TechnologyName: 'MSAA'
Name: 'E-mail'
ControlType: 'MenuItem'This is a drop down item, other items from same list clicked ok, anything that is special to this item is '-' inside its name, for "Fax" - ok, for "E-mail" - exception.
Has anyone any ideas?
כל התגובות
-
יום שלישי 14 אוגוסט 2012 15:28
Hi,
What type of application / controls are you talking about?
As far as I know there should be no problem with a special char in a value of a search property. I have been working with such values for a long time.
My best guess is that it has something to do with the loading time of the UI. See it takes a split second for the items in the dropdown menu list to load on to the UI. If the search for the specific item accrues during that time it might miss the fact that it is now displayed on the UI – resulting with your exception.
If that is the case, try invoking the menu item click action in two steps: first click the visible item that opens the dropdown menu, and then click the requested menu item. If that is not enough, add a short wait time between the clicks.
Hope this salves your problem.
Elizur Mach
ALM team, Sela group.
-
יום רביעי 15 אוגוסט 2012 07:09
I'm working with add-in for Microsoft Word 2010, add-in adds button to ribbon and this button has dropdown menu. Click works perfect for another items from same dropdown, so I don't think that problem in loading time. The code I tried to execute
// Click drop down button
Mouse.Click(uICasehandlerMenuItem, new Point(57, 12));
System.Threading.Thread.Sleep(4000);
var exists=uIEmailMenuItem.Exists;
// Click 'E-mail' menu item
Mouse.Click(uIEmailMenuItem, new Point(41, 13));In this case I get an exception on Mouse.Click(), but, what is very strange to me, 'exists' variable is true! Can I perform click without using Mouse.Click() method?
-
יום חמישי 16 אוגוסט 2012 08:15מנחה דיון
Thanks for Elizur’s help.
Hi koshdim,
Thank you for posting in the MSDN forum.
Not very sure about your real app, maybe you could try to check it with the following steps.
- Like Elizur’s suggestion, use the Playback.PlaybackSettings.WaitForReadyTimeout = 60000;
- Use the FindMatchingControls() to verify if more than one control matches.
- If you use the DrawHighlight() on the control, do you see any bounding rectangle being drawn on the UI?
- Do not set any relative coordinates, just Mouse.Click(button) and check it.
Reference:
Cannot perform 'click' on the hidden control
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
-
יום חמישי 16 אוגוסט 2012 12:22
Thanks for response
Tried this code:
Playback.PlaybackSettings.WaitForReadyTimeout = 60000;
var isExists = uIEmailMenuItem.Exists;
var howMany = uIEmailMenuItem.FindMatchingControls().Count;in the end of this code block I put a breakpoint, isExists==true and howMany==0, what does it mean? am I miss something?
and yes, click still doesn't work
-
יום חמישי 16 אוגוסט 2012 18:41
Hi,
I think it's time to let you in on a little professional secret:
In such cases, when the error message says that the control is blocked but examining the UI with Coded UI Test Builder doesn't reveal any possible cause I use an aggressive workaround: I always have a "Common" class including the fallowing method:
"Public Void AggressiveClick(UITestControl, control,)
{
Rectangle r = control.BoundingRectangle;
int x = (r.X + (r.Width / 2));
int y = (r.Y + (r.Height / 2));
Mouse.Click(new Point(x, y));
}"
This way I force the playback to click the center of the control ignoring the control's state. Of course this has it down sides: the control has to be visible and displayed on the screen at the time of the click. "control.EnsureClickable()" will not scroll it in to view, it will throw the same exception. But in most cases, especially when dealing with third party controls, it works.
Hope this salves your problem.
Elizur Mach
ALM team, Sela group.
-
יום שישי 17 אוגוסט 2012 01:12
Hi,
Adding up to Elizur, we also use similar approach in such cases wherein we check the size of the bounding rectangle of the object under consideration and if it is > 0 only then its visible on the screen. else no point trying to click the control.
Regards,
Pankaj
Utility to run CUIT Ordered Tests for multiple iterations (Now with automated result mailing) @ http://cuitbatchrunner.codeplex.com/
-
יום שישי 17 אוגוסט 2012 08:06control.BoundingRectangle is (0,0,0,0), but I see the control that it is visible and not disabled
-
יום שלישי 21 אוגוסט 2012 06:18מנחה דיון
Hi koshdim,
This is a drop down item, other items from same list clicked ok, anything that is special to this item is '-' inside its name, for "Fax" - ok, for "E-mail" - exception.
Maybe you could copy the same test project to the PC which has this issue, and run it locally to find something.
I couldn’t repro this issue, maybe you could try to use the UITestControl.DrawHighlight() for the control and check whether it could It draw a blue rectangle around the UI Test Control.
Can I perform click without using Mouse.Click() method?
In addition, I did some research about this issue, and found a blog about the Automating Mouse actions with two button clicked at same time, maybe it could provide useful information to perform click without the Mouse.Click() method. Hope it could help.
If still no help, could you share us a simple sample? We try to record a test for it.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
-
יום שלישי 21 אוגוסט 2012 10:17
unfortunately I cannot share code because it is part of commercial product. and I can reproduce it only with this particular item.
DrawHighlight() on this control executes successfully but I see no blue rectangle:(
-
יום שלישי 21 אוגוסט 2012 19:34
Hi,
Are you sure that you actually got the right control?
There might be more than one control with the same search properties.
Try this:
- Initialize the control.
- Add search properties.
- Call "var controls = UITestControl.FinfMachingControls()"
- foreach (UITestControl ctrl in controls) ctrl.DrawHighlight();
- Insert a break point in the iteration and see whether the first control in this collection is actually the one you mean.
Hope this answers your question.
Elizur Mach
ALM team, Sela group.
-
יום רביעי 22 אוגוסט 2012 08:16"Call "var controls = UITestControl.FinfMachingControls()"" - controls.Count is 0
-
יום חמישי 23 אוגוסט 2012 02:57מנחה דיון
Hi koshdim,
Glad to receive your reply.
Could you share us a screen shot about the control when you added DrawHighlight() on this control?
Did you install the VS2010 FP2? If you install it, did you get this control in the UI Control Map when you open your UIMap.uitest file? Right click this control->Locate the UI Control, did you get any information?
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
-
יום חמישי 23 אוגוסט 2012 08:59
there is E-mail item on screenshot that must be clicked.
DrawHighlight() doesnt produce any rectangle.
Locate the UI control doesn't work because dropdown closes when I click anything outside Word -
יום שישי 24 אוגוסט 2012 03:31מנחה דיון
Hi koshdim,
Glad to receive your reply.
So you record a method for other controls like “Name1” or “Name 2”, they all worked well, just the E-mail control has this issue, am I right? Whether the E-mail control is the custom control?
It is hard for us to repro this issue, but if other control worked well, just this control has this issue; I doubt that this control doesn’t support the coded UI tests. Maybe you could add more search properties for this control and check it again. If you just add the DrawHighlight() for the “Case Handler” control, can you get a blue rectangle around it?
Since you couldn’t share us the app, if still no help, I’m afraid that this question requires a more in-depth level of support. I suggest you visit the following link to see the various paid support options that are available to better meet your needs.http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone. Thanks for your understanding.
Sincerely,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- סומן כתשובה על-ידי koshdim יום שני 27 אוגוסט 2012 07:03
-
יום שני 08 אוקטובר 2012 19:05
I'm facing a similar issue and none of the above worked for me. It draws the blue box around the control but fails to click on it and it's a button not a complex control at all.
Instead of you guys wasting our time porting this tool over to the new interface you should have focused on better object recognition. Now I sit here with a freaking testing tool that can't interact with a UI. Here is the extremely complex dialog (saracasm) that this tool can't interact with. About 1/2 the time it can't find the combo box and the other half the time it can't find the "Add Document" button. These controls are both unique and they are found both in the UI builder tool and with draw highlights but the tool fails to act on them. What a freaking joke!
- נערך על-ידי GLimbaugh יום שני 08 אוקטובר 2012 20:04
-
יום שלישי 09 אוקטובר 2012 11:12I stopped wasting my time for this. Instead we decided to use UIMaps as less as possible, developers will provide API for auto-testers call methods on objects instead of relying on UI mappings
-
יום שלישי 09 אוקטובר 2012 12:41I also have stopped wasting my time. I've recomended we give up our efforts on this tool entirely and go to QTP since it takes about 1/4 of the time to develop tests in that tool.
-
יום שלישי 20 נובמבר 2012 20:29בעלים
Office Client Applications are not supported for coded UI Testing.
Please see:
Supported Configurations and Platforms for Coded UI Tests and Action Recordings
Thank you
- סומן כתשובה על-ידי koshdim יום רביעי 21 נובמבר 2012 07:52