ListBox UIActionException after populated with items

Jun 30, 2008 at 6:21 PM
For some reason when the ListBox I am trying to automate has elements in it, every call I make to it results in a UIActionException. Before it is populated I make the same calls and do not get the exception.
This is the code that throws the exception

    //This code gets the empty list box and gets the selected item from the listbox(null -- exception not thrown)
    Core.UIItems.ListBoxItems.

ListControl results = window.Get<Core.UIItems.ListBoxItems.ListControl>("resultsListBox");
    ListItem item = results.SelectedItem;

    //Once the list box has been populated with items, trying to get the currently selected item results in a UIActionException
    
item = results.SelectedItem; //Currently throwing UIActionException

 

 

 

 

 

Error Message: 

Test method ComponentTests.CustomerSearchTester.CustomerSearch_ReturnResults threw exception:  Core.UIItems.UIActionException: Could not make the ListBox with AutomationId=resultsListBox and Name=<empty> visible, after waiting for 5000 ms.

Stack Trace: 

b__2() in d:\white-os\Core\UIItems\Scrolling\ScreenItem.cs: line 32
Bricks.Core.Clock.RunWhile(DoAndNoReturn do, Condition condition, Expired expired) in D:\bricks\Bricks\Core\Clock.cs: line 54
Core.UIItems.Scrolling.ScreenItem.MakeVisible(VerticalSpan verticalSpan) in d:\white-os\Core\UIItems\Scrolling\ScreenItem.cs: line 27
Core.UIItems.WindowItems.Window.ActionPerforming(UIItem uiItem) in d:\white-os\Core\UIItems\WindowItems\Window.cs: line 362
Core.Interceptors.ScrollInterceptor.PreProcess(IInvocation invocation, Object target) in d:\white-os\Core\Interceptors\ScrollInterceptor.cs: line 13
b__4(DynamicProxyInterceptor obj) in D:\bricks\Bricks\DynamicProxy\DynamicProxyInterceptors.cs: line 19
ForEach(Action`1 action)
Bricks.DynamicProxy.DynamicProxyInterceptors.Process(IInvocation invocation, InterceptContext interceptedContext) in D:\bricks\Bricks\DynamicProxy\DynamicProxyInterceptors.cs: line 19
Core.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in d:\white-os\Core\Interceptors\CoreInterceptor.cs: line 29
Castle.DynamicProxy.AbstractInvocation.Proceed() in d:\OSS\Castle\Tools\Castle.DynamicProxy2\Castle.DynamicProxy\AbstractInvocation.cs: line 165
ListBoxProxye1934f5991284d6286a9e473bdd106ba.get_SelectedItem()
ComponentTests.CustomerSearchTester.CustomerSearch_ReturnResults() in C:\QAonTFS\Development\SSCUIAutomation\ComponentTests\CustomerSearchTester.cs: line 54


Also it's not just getting the SelectedItem of the ListBox that is throwing the UIActionException after it has been populated with items. It seems like any call I make to it will give me this exception after the ListBox has been populated.

Anymore info i can get on this i'm sure will help

thanks,
travis

Coordinator
Jul 1, 2008 at 4:23 PM
Do you have scrollbar in your window? Is the listbox visible inside it?
When you get the exception, can you do window.LogStructure() and send me the console output.
Jul 1, 2008 at 6:39 PM
There is a scrollbar in my window and the listbox is visible within it however when i set LogActions="true" in my App.config and try to run my test i get a StackOverflowException in ScreenItem.cs (core.dll) so i'm unable to get the output from window.LogStructure()...

Is there another way i can get the log information?

thanks,
travis
Coordinator
Jul 2, 2008 at 8:11 PM
Have you configured the log4net.config for your tests. Its documented on the website.
If it is possible for you can you let me know the repeated stacktrace when you are getting the stackoverflow exception.
Jul 2, 2008 at 11:37 PM
I can't get the stackoverflow to reproduce anymore (my VSTestHost just crashes now) but here is how i have log4net configured:

In my test project i have a file called log4net.config in my test project with the following contents:

<?

 

xml version="1.0" encoding="utf-8" ?>
<
log4net>
    <
root>
        <
level value="Info" />
        <
appender-ref ref="Console" />
        <
appender-ref ref="White" />
    </
root>
    <
appender name="White" type="log4net.Appender.RollingFileAppender">
        <
file value="White.log" />
        <
appendToFile value="true" />
        <
maximumFileSize value="5MB" />
        <
maxSizeRollBackups value="10" />
        <
layout type="log4net.Layout.PatternLayout">
            <
conversionPattern value="[%d][%-5p] %m%n" />
        </
layout>
    </
appender>
    <
appender name="Console" type="log4net.Appender.ConsoleAppender">
        <
layout type="log4net.Layout.PatternLayout">
            <
conversionPattern value="[%d][%-5p] %m%n" />
        </
layout>
    </
appender>
</
log4net>

This is the App.config i have set up in my test project:

<?

 

xml version="1.0" encoding="utf-8" ?>
<
configuration>
    <
configSections>
        <
sectionGroup name="White">
            <
section name="Core" type="System.Configuration.NameValueSectionHandler"/>
        </
sectionGroup>
    </
configSections>
    <
White>
        <
Core>
            <
add key="LogActions" value="true" />
            <
add key="WorkSessionLocation" value="." />
            <
add key="PopupTimeout" value="5000" />
            <
add key="MouseDelayForTooltip" value="0" />
            <
add key="SuggestionListTimeout" value="3000" />
            <
add key="BusyTimeout" value="1000" />
            <
add key="WaitBasedOnHouseGlass" value="true" />
            <
add key="UIAutomationZeroWindowBugTimeout" value="5000" />
            <
add key="TooltipWaitTime" value="3000" />
        </
Core>
    </
White>
</
configuration>

 

 

 

 

Would the fact that i'm using visual studio's testing framework instead of White.NUnit affect this at all?

Coordinator
Jul 4, 2008 at 8:32 PM
Should not be because you are using MSTest for sure. Is your log4net.config getting copied to bin\debug (output) folder?
Can you also send me what is printed on the console?  
Jul 7, 2008 at 6:30 PM
As far as I know my log4net.config is being seen. I'm using a Visual Studio Test Project which means the output folder changes with each test run so i'm telling it to use the same one with log4Net.Config.XmlConfigurator.ConfigureAndWatch(FileInfo fileInfo).

Since trying to access any UIItem (e.g. textBox.Text = value) crashes visual studio when LogActions="true", i debugged and stepped over all these calls (manually doing the ui clicks) until i got to my listbox being populated with items and the window.LogStructure() call.

If I can have your email I'll attach the White.log so you can take a look.

Send email to tlightbourne@extendhealth.com

thanks,
travis
Jul 14, 2008 at 8:27 PM
The exception gets thrown when the IsOutside() method of the Core.VerticalSpan class returns true to the Clock.RunWhile() 'condition' delegate and the BusyTimeout expires leading to the 'expired' delegate of the Clock.RunWhile() method to fire, throwing the UIActionException (this takes place in Core.UIItems.Scrolling.ScreenItem in the MakeAvailable() method).

I assume what it's trying to do is get the center of my ListBox within the bounds of the window but the call to verticalScroll.ScrollDownLarge() does nothing due to the fact that verticalScroll is a Core.UIItems.Scrolling.NullVScrollBar

Do you know of any current workaround to this Vivek?
Coordinator
Jul 15, 2008 at 3:12 PM
Yes, you can do this in CoreAppXmlConfiguration class.

        private CoreAppXmlConfiguration() : base("White", "Core", defaultValues, WhiteLogger.Instance)
        {
            interceptors.Add(new FocusInterceptor());
//            interceptors.Add(new ScrollInterceptor());
            ModifyLogInterceptor(S.ToBool(usedValues[logActionsKey]));
        }


Since you have figured out what exactly is the problem. Can you send me the details of ListBox from UISpy.
Or if you can find out a better way by which I can reproduce this issue it would be great.
Thanks for pointing out the issue.
Jul 15, 2008 at 6:32 PM
This is only a problem when more than half the list box is completely outside the edges of the containing window and there is no way to scroll down to get the center of the listbox within the upper and lower bounds of the window. The IsOutside() method finds the center of the listbox and then checks to see if this y coordinate is in between the top and bottom edge of the window.

I think the only reason why it couldn't scroll down is due to the fact that the scrolling of my listbox is controlled by a wpf scrollviewer instead of the window's scrollbars which are of the NullScrollBar type.

UISpy of ListBox:

AutomationElement

General Accessibility

AccessKey: ""

AcceleratorKey: ""

IsKeyboardFocusable: "True"

LabeledBy: "(null)"

HelpText: ""

State

IsEnabled: "True"

HasKeyboardFocus: "False"

Identification

ClassName: "ListBox"

ControlType: "ControlType.List"

Culture: "(null)"

AutomationId: "resultsListBox"

LocalizedControlType: "list view"

Name: ""

ProcessId: "988 (ExtendHealth.Ssc)"

RuntimeId: "7 988 66748299"

IsPassword: "False"

IsControlElement: "True"

IsContentElement: "True"

Visibility

BoundingRectangle: "(539, 226, 473, 1599)"

ClickablePoint: "775.5,1025.5"

IsOffscreen: "False"

ControlPatterns

Selection

Selection: ""

CanSelectMultiple: "False"

IsSelectionRequired: "False"


UISpy of Window:

AutomationElement

General Accessibility

AccessKey: ""

AcceleratorKey: ""

IsKeyboardFocusable: "True"

LabeledBy: "(null)"

HelpText: ""

State

IsEnabled: "True"

HasKeyboardFocus: "False"

Identification

ClassName: "Window"

ControlType: "ControlType.Window"

Culture: "(null)"

AutomationId: ""

LocalizedControlType: "window"

Name: "Sales support center"

ProcessId: "988 (ExtendHealth.Ssc)"

RuntimeId: "42 329204"

IsPassword: "False"

IsControlElement: "True"

IsContentElement: "True"

Visibility

BoundingRectangle: "(23, 23, 1024, 768)"

ClickablePoint: "543,435"

IsOffscreen: "False"

ControlPatterns

Transform

CanMove: "True"

CanResize: "True"

CanRotate: "False"

Window

CanMaximize: "True"

CanMinimize: "True"

IsModal: "False"

WindowVisualState: "Normal"

WindowInteractionState: "ReadyForUserInteraction"

IsTopmost:


The bottom of the window is at 791. The top of my listbox is at 226 and the bottom of my listbox is at 1825 making the center 1025.5 which is greater than the bottom of my window causing the IsOutside() method to return true which in turn causes the RunWhile method (which has timed out) of the MakeAvailable call to throw the UIActionException.
Coordinator
Jul 26, 2008 at 1:48 PM
Please try your scenario when the release 0.17 comes out.
Jul 28, 2008 at 2:54 PM
When is release 0.17 planned on being released? 
Coordinator
Jul 31, 2008 at 3:25 AM
Sometime between 10-15 Aug.