Clicking on buttons in msiexec process does not work

Aug 2, 2011 at 12:36 PM

Hi,

We are trying to simulate user's interaction with our setup created by InstallShield.

Here is a sample code:

Process msiexec = Process.GetProcessesByName( "msiexec" ).FirstOrDefault( p => p.MainWindowTitle == "Test Application - InstallShield Wizard" );

Application app = Application.Attach( msiexec );           
Window window = app.GetWindows().Last();
Button button = window.Get<Button>( SearchCriteria.ByText( "Next >" ) );
button.Click();

This does not do anythign at all - just activates a window, which is a first standard Welcome dialog.

When we use button.RaiseClickEvent() we will get 

Bricks.BricksException : Error invoking Button.RaiseClickEvent
----> System.InvalidOperationException : Operation is not valid due to the current state of the object.

This is Windows 7, x64, Enterprise. Visual Studio 2010, nUnit test run from the ReSharper 6 window. Project targets x86 CPU.

 

Please, help me - how can I click on a button?

 

Cheers,

Alex

Aug 2, 2011 at 12:49 PM

Hi

 

what is the state of the button I think you will find out that the button is disabled

try Assert.IsTrue(button.Enabled);

maybe you should whait a short time, before the button is enabled

 

Throndorin

Aug 3, 2011 at 7:58 AM

The button is enabled. I checked that in Debug mode and also placed your assert.

Aug 3, 2011 at 9:00 AM

debug mode might be to slow, but if assert is true in normal test run there might be an other problem.

can you stop after normal click and have a look where the mouse pointer is, not over the button I think?

have you tried the new release? The problem might be Win7x64 but project target x86 as workaround should help in White 2.0

Which informations has UIAverify for this button?

 

Throndorin

Aug 3, 2011 at 9:16 AM
Edited Feb 16, 2012 at 12:22 PM

Here is a log file for the test I posted to you in my first post:

 

[2011-08-03 12:13:24,502][INFO ] Using BusyTimeout=5000 for White/Core
[2011-08-03 12:13:24,529][INFO ] Using WaitBasedOnHourGlass=True for White/Core
[2011-08-03 12:13:24,530][INFO ] Using WorkSessionLocation=. for White/Core
[2011-08-03 12:13:24,532][INFO ] Using UIAutomationZeroWindowBugTimeout=5000 for White/Core
[2011-08-03 12:13:24,533][INFO ] Using PopupTimeout=5000 for White/Core
[2011-08-03 12:13:24,533][INFO ] Using TooltipWaitTime=0 for White/Core
[2011-08-03 12:13:24,534][INFO ] Using SuggestionListTimeout=3000 for White/Core
[2011-08-03 12:13:24,534][INFO ] Using DefaultDateFormat=Day,Month,Year for White/Core
[2011-08-03 12:13:24,535][INFO ] Using DragStepCount=1 for White/Core
[2011-08-03 12:13:24,535][INFO ] Using InProc=False for White/Core
[2011-08-03 12:13:24,538][INFO ] Using ComboBoxItemsPopulatedWithoutDropDownOpen=True for White/Core
[2011-08-03 12:13:24,539][INFO ] Using RawElementBasedSearch=False for White/Core
[2011-08-03 12:13:24,539][INFO ] Using MaxElementSearchDepth=10 for White/Core
[2011-08-03 12:13:24,539][INFO ] Using DoubleClickInterval=0 for White/Core
[2011-08-03 12:13:24,540][INFO ] Using MoveMouseToGetStatusOfHourGlass=True for White/Core
[2011-08-03 12:13:24,705][INFO ] Using TableVerticalScrollBar=Vertical Scroll Bar for White/UIItemId
[2011-08-03 12:13:24,705][INFO ] Using TableHorizontalScrollBar=Horizontal Scroll Bar for White/UIItemId
[2011-08-03 12:13:24,706][INFO ] Using TableColumn=Row  for White/UIItemId
[2011-08-03 12:13:24,706][INFO ] Using TableTopLeftHeaderCell=Top Left Header Cell for White/UIItemId
[2011-08-03 12:13:24,707][INFO ] Using TableCellNullValue=(null) for White/UIItemId
[2011-08-03 12:13:24,707][INFO ] Using TableHeader=Top Row for White/UIItemId
[2011-08-03 12:13:24,708][INFO ] Using HorizontalScrollBar=Horizontal ScrollBar for White/UIItemId
[2011-08-03 12:13:24,708][INFO ] Using VerticalScrollBar=Vertical ScrollBar for White/UIItemId
[2011-08-03 12:13:24,708][INFO ] Using TableCellPrefix= Row  for White/UIItemId
[2011-08-03 12:13:25,180][DEBUG] Could not set focus on AutomationId:, Name:<CUT> - InstallShield Wizard, ControlType:window, FrameworkId:Win32
[2011-08-03 12:13:25,186][DEBUG] Vertical scrollbar is not scrollable for parent of Button. AutomationId:2761, Name:Next >, ControlType:button, FrameworkId:Win32
Using RecheckDurationInMilliseconds=100 for Bricks/Bricks
[2011-08-03 12:13:25,316][DEBUG] Could not set focus on AutomationId:, Name:<CUT> - InstallShield Wizard, ControlType:window, FrameworkId:Win32
[2011-08-03 12:13:25,321][DEBUG] Vertical scrollbar is not scrollable for parent of Button. AutomationId:2761, Name:Next >, ControlType:button, FrameworkId:Win32
[2011-08-03 12:13:25,323][DEBUG] Could not set focus on AutomationId:, Name:<CUT> - InstallShield Wizard, ControlType:window, FrameworkId:Win32
[2011-08-03 12:13:25,327][DEBUG] Vertical scrollbar is not scrollable for parent of Button. AutomationId:2761, Name:Next >, ControlType:button, FrameworkId:Win32
[2011-08-03 12:13:25,352][DEBUG] Could not set focus on AutomationId:, Name:<CUT> - InstallShield Wizard, ControlType:window, FrameworkId:Win32
[2011-08-03 12:13:25,356][DEBUG] Vertical scrollbar is not scrollable for parent of Button. AutomationId:2761, Name:Next >, ControlType:button, FrameworkId:Win32
[2011-08-03 12:13:25,372][DEBUG] Could not set focus on AutomationId:, Name:<CUT> - InstallShield Wizard, ControlType:window, FrameworkId:Win32
[2011-08-03 12:13:25,378][DEBUG] Vertical scrollbar is not scrollable for parent of Button. AutomationId:2761, Name:Next >, ControlType:button, FrameworkId:Win32
[2011-08-03 12:13:25,391][INFO ] 
AutomationId: 2761
ControlType: ControlType.Button
Name: Next >
HelpText: 
Bounding rectangle: 927,585,88,22
ClassName: Button
IsOffScreen: False
FrameworkId: Win32
ProcessId: 6660

System.Windows.Automation.InvokePattern

 

This is a latest version of White. Form is clicked - this is for sure, because form is activated on button.Click() call.

Aug 3, 2011 at 3:05 PM

Found the problem:

 - I run tests from Visual Studio 2010, which I started usually. I have an administrator account and UAC turned Off completely.

 - msiexec process runs my setup.exe, which has embedded manifest, which states that setup has to be run by admins only

 - that is why, unprivileged VS2010 hadn't acccess to inject into privileged msiexec

 

When I started VS2010 as administartor, my test passed successfully!

Cheers, for a great framework!