Git Product home page Git Product logo

white's Introduction

DEPRECATED - no longer actively maintained

The White project lacks maintainers and community activity. As last maintainer, I tried to bring back some life to White but quickly ended up tripping over issues with the old architecture of this project which prevented implementing some features I wanted (eg. UIA3 support).

For that reason, a new project called FlaUI was born. FlaUI is a complete rewrite from scratch that supports UIA2 (Managed) and UIA3 (Interop), is easily extensible, supports .NET Core and .NET Standard and allows accessing all UIA features up to the latest Windows SDK.

FlaUI is now mature enough to be the successor of White and is already widely used. There is also an adapter available that allows re-using some of the syntax of White but execute it in FlaUI (feel free to help improving it).

Thanks for all the creators and maintainers of White for this great project but now it is time to head over to FlaUI. Feel free to raise questions, problems, improvement ideas in gitter or in FlaUIs issues.

I hope to see you there.

TestStack.White

White is a framework for automating rich client applications based on Win32, WinForms, WPF, Silverlight and SWT (Java) platforms. It is .NET based and does not require the use of any proprietary scripting languages. Tests/automation programs using White can be written with whatever .NET language, IDE and tools you are already using. White provides a consistent object-oriented API, hiding the complexity of Microsoft's UIAutomation library (on which White is based) and windows messages.

Join the chat at https://gitter.im/TestStack/White

Introduction

Project white has been inactive for some time, but still has many users and is a great UI automation framework.

TestStack has brought this project into it's offering to try and breathe some life into Project White.

Build Status

Master Branch

Build status Test status Documentation Status

UIAComWrapper Branch

Build status Test status

Contributing

White needs contributors to keep improving. There is plenty to do:

  • Write documentation. Currently on docs.teststack.net but will likley be migrated to the GitHub wiki, the wiki is publically editable so jump in, migrate a page or improve an existing one.
  • Look into any of the open issues, submit a pull request or suggest a fix which could help the issue be closed
  • Pick up a failing test on the https://github.com/TestStack/White/tree/UIAComWrapper branch.
  • Add a new test

Getting Started

Install TestStack.White from NuGet

PM> Install-Package TestStack.White

Now download one or more of these tools. Each of these has their own strengths and weaknesses and generally using more than one to view the automation properties will be required.

  • Inspect - This is part of the Windows SDK and is a good tool in general for looking at automation properties.
  • UI Automation Verify - Also part of the Windows SDK another good general tool for looking at automation properties. There's a fork of original UIAVerify that allows usage of custom patterns and custom properties. For an example how to add your own custom pattern or property to your application, look at this project.
  • Snoop - Only works with WPF applications and is really good at it. Offers much more functionality than just viewing the automation properties.
  • Spy++ - This is included in visual studio under the tools menu option. This is good for working with Winforms, Win32 and VB6 applications because it allows you to view the applications window messages and automation properties.

See the sample apps here for examples of using White in both WinForms and WPF.

Documentation

Documentation Status

Change Log

http://docs.teststack.net/White/ChangeLog.html

Documentation

http://teststackwhite.readthedocs.org/en/latest

Discussion Group

https://groups.google.com/forum/#!forum/teststack_white

Sample Applications

https://github.com/TestStack/White/tree/master/src/Samples

Whites UI Tests

https://github.com/TestStack/White/tree/master/src/TestStack.White.UITests

Contributions to White's documentation is welcome

Contributing to White

Pull Requests for White are welcome, please include either Unit or UI Tests covering your changes if possible.

Setting up Git

http://jake.ginnivan.net/setting-up-git

Contributing to a TestStack Project

http://teststack.azurewebsites.net/Contributing.html

Reporting Issues

If possible, please add a failing test to TestStack.White.UITests when you report an issue, this will allow me to fix it, and ensure there is no regression later.

Also include the following information:

  • Operating System
  • Target Framework (WPF, Winforms etc)
  • Optionally but preferred, a failing test or a repro solution.

Credits

Thanks to Thoughtworks and specifically Vivek Singh for starting this project. We have got permission from Vivek to continue this project.

TestStack.White will supersede the following repositories:
http://white.codeplex.com/
https://github.com/petmongrels/white
https://code.google.com/p/white-project/

white's People

Contributors

adlanelm avatar austinmatherne avatar cbigsby avatar daveweath avatar dpisanu avatar eric-winkler avatar gitter-badger avatar glombard avatar gpomykala avatar heskandari avatar ilya-murzinov avatar ivan-danilov avatar jakeginnivan avatar jalla347 avatar jason-roberts avatar johanlarsson avatar jozefizso avatar lostmsu avatar matt-jenner avatar mehdik avatar mmattes avatar navaneeth avatar ritro avatar rlbisbe avatar roemer avatar seriousm avatar sghill avatar toddwprice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

white's Issues

Unable to click twice on menu item

Hi

I have a problem with second click menu item. First try always works, second one ends with exception:

White.Core.AutomationException: Cannot perform action on Menu. Cannot display automation element details. The UIItem might have been disposed, element not enabled

To reproduce it you can create a simple test with calculator and try to click Edit->Copy twice in a row.

Thanks,
Marcin

Build Component support into White

Currently the Repository project supports components, add support in white directly once the new AppScreen functionality has been completed

CI Build

Improve CI build so it runs all the UI Tests as part of the build
Get running on a CI server

Clickable Point throws exception

HyperLink.ClickablePoint throws a TargetInvocationException. Unfortunantely I needed to get the clickable point so I could click on a hyperlink in our app (don't ask why). It would be great if this could get fixed soon.

Stack Trace:
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at White.Core.Bricks.DynamicProxyInterceptors.Process(IInvocation invocation, CoreInterceptContext interceptedContext)
at White.Core.Interceptors.CoreInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.HyperlinkProxy.get_ClickablePoint()
at TestProject1.LoginPage.Login(String username, String password) in C:\MyData\Visual Studio 2010\Projects\TestProject1\TestProject1\MyApp.cs:line 64
at TestProject1.LoginTests.TestLogin() in C:\MyData\Visual Studio 2010\Projects\TestProject1\TestProject1\MyApp.cs:line 88

TestStack.White with Ribbon Application menu

Has anyone used TestStack.White with a Ribbon menu?

I'm having a problem clicking the buttons in the application menu (ball menu).

If I get the ball menu itself and click it the menu items are shown and then i can get the button I want.

The problem is that the item's IsOffScreen property is true therefore I can't click it.

Any ideas?

Thanks,

Jamie

VisibleImage returns empty picture for ListViewRow

Hi

I noticed that VisibleImage property does not work correctly for ListViewRow or ListViewCell for (at least in my case) SysListView32 control. It returns empty picture (black dot 1x1 pixel). In GetVisibleImage method for DisplayedItem in case of these UIItems width and height of rectangle to capture is 0.

EDIT:

This probably might be caused by the fact NativeWindowHandle for rows and cells is 0;

Current solution for capturing screenshots is based on code from developer fusion site. I was wondering about simpler method for doing it, like:

            Bitmap bitmap = new Bitmap ( bounds.Width, bounds.Height );

            using ( Graphics g = Graphics.FromImage ( bitmap ) )
            {
                g.CopyFromScreen ( bounds.Left, bounds.Top, 0, 0, bounds.Size );
            }

and correlate it with Bounds of the control??

Best Regards
marcin

BadImageFormatException

Hi,

I have an issue with the nuget-package of TestStack.White.
My development machine is a Windows 7 Pro 64bit and VisualStudio 2012.

In my project I added a ConsoleApplication and installed via Nuget the TestStack.White package.

The Program.cs of the ConsoleApplication looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using White.Core;

namespace gui_test
{
    class Program
    {
        static void Main(string[] args)
        {
            Application application = Application.Launch(@"gui.exe");
        }
    }
}

When executing the application I get an BadFormatException:
(sorry, just available in german)
{"Die Datei oder Assembly "TestStack.White, Version=0.9.3.27, Culture=neutral, PublicKeyToken=2672efbf3e161801" oder eine Abhängigkeit davon wurde nicht gefunden. Es wurde versucht, eine Datei mit einem falschen Format zu laden."}

Any Ideas?

KeyboardTest.ShouldSetTheVa lueOfATextBox

Test failing when

  1. Test Failure : White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheVa lueOfATextBox
    String lengths are both 9. Strings differ at index 1.
    Expected: "[];',./-" But was: "89;',./-"
    ------------^

at White.Core.UITests.InputDevices.KeyboardTest.EnterAndAssertValueOfTextEntered(String stringToType) in c:\DATA\GitHub\White\src\TestStack.White.UITests\InputDevices\KeyboardTest.cs:line 81
at White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheValueOfATextBox() in c:\DATA\GitHub\White\src\TestStack.White.UITests\InputDevices\KeyboardTest.cs:line 40

Add TestStack.White.Quickstart.XUnit

Should create a WhiteTestBase class in your test project with a ctor/Dispose method which starts and tears down your application and any other hooks that should be registered for a test

XPath alike mechanism to select UI objects in an application

For Web applications there is the XPath standard that uses path expressions to select nodes or node-sets in an XML document. This is a flexible and powerful mechanism to search for and select application elements.

It would be great to have a similar mechanism in TestStack/White for GUI applications. "UIItemPath" could have a similar syntax as XPath. This could be used for UIItem identification and in search criteria expressions. This would also provide a mechanism to define a search criteria for deeper and structured search expressions.

The present method in White for searching and selecting GUI objects is very cumbersome and code intensive. For complex GUI structures a lot of code is required to find and select an object.

Cheers
Piotr

ListView rows empty

Hi,

I am trying to do some tests using a listview.

I successfully get the control by the normal method GetElement(SearchCriteria.ByAutomationId("listView")) etc.

It correctly shows the Header and its columns, but when I then try to look at the Rows and SelectedRows properties they have a count of 0 so I cannot test anything!

Does anyone have any ideas on what I am doing wrong?

Thanks,

Nicole

ListBoxItems.ComboBoxTest fails

I just tried to run the UITests included in White. My results is as below. 1 error and 3 failures. Am I doing something wrong here or is the current status?

System: Windows 7 64 Bit (Build 7601, SP 1)

Tests run: 281, Errors: 1, Failures: 3, Inconclusive: 0, Time: 653,5093786 se
conds
Not run: 13, Invalid: 0, Ignored: 13, Skipped: 0

Errors and Failures:

  1. Test Failure : White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheVa
    lueOfATextBox
    Expected string length 2 but was 7. Strings differ at index 0.
    Expected: "ab"
    But was: "Texboab"
    -----------^

at White.Core.UITests.InputDevices.KeyboardTest.EnterAndAssertValueOfTextEnte
red(String stringToType) in c:\DATA\GitHub\White\src\TestStack.White.UITests
InputDevices\KeyboardTest.cs:line 81
at White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheValueOfATextBox()
in c:\DATA\GitHub\White\src\TestStack.White.UITests\InputDevices\KeyboardTes
t.cs:line 35

EXEC : 2) Test error : White.Core.UITests.Interceptors.DisabledControlsTest.All
owActionsPossibleOnDisableControls [C:\Data\GitHub\White\White.msbuild]
System.NullReferenceException : Object reference not set to an instance of
an object.
at White.Core.UITests.Interceptors.DisabledControlsTest.AllowActionsPossib
leOnDisableControls() in c:\DATA\GitHub\White\src\TestStack.White.UITests\Int
erceptors\DisabledControlsTest.cs:line 52

  1. Test Failure : White.Core.UITests.UIItems.ListBoxItems.ComboBoxTest.Select
    Expected string length 13 but was 1. Strings differ at index 0.
    Expected: "Arundhati Roy"
    But was: "7"
    -----------^

at White.Core.UITests.UIItems.ListBoxItems.ComboBoxTest.Select() in c:\DATA\G
itHub\White\src\TestStack.White.UITests\UIItems\ListBoxItems\ComboBoxTest.cs:
line 54

  1. Test Failure : White.Core.UITests.UIItems.TextBoxTest.EnterText
    Expected string length 0 but was 13. Strings differ at index 0.
    Expected: <string.Empty>
    But was: "somethingElse"
    -----------^

at White.Core.UITests.UIItems.TextBoxTest.EnterText() in c:\DATA\GitHub\White
\src\TestStack.White.UITests\UIItems\TextBoxTest.cs:line 27

Tests Not Run:

Application.AttachOrLaunch() fails with path names with folders

Application.AttachOrLaunch() fails with path names with folders

Application.cs
line marked new line

    public static Application AttachOrLaunch(ProcessStartInfo processStartInfo)
    {
        string processName = ReplaceLast(processStartInfo.FileName, ".exe", string.Empty);
        processName = Path.GetFileName(processName);        // new line
        Process[] processes = Process.GetProcessesByName(processName);
        if (processes.Length == 0) return Launch(processStartInfo);
        return Attach(processes[0]);
    }

This is a problem when

        ProcessStartInfo processStartInfo = new ProcessStartInfo("C:\Program Files (x86)\Dwarf\Sissle1400\xxxxxxx.exe");
        application = Application.AttachOrLaunch(processStartInfo);

Details
Most example on the Net give example like NotePad (no folders), this presents no problem.
I use C:\Program Files (x86)\Dwarf\Sissle1400\xxxxxxx.exe and this definetly does not work. The attach part requires only the file part xxxxxxx.exe.
Note: Launch requires C:\Program Files (x86)\Dwarf\Sissle1400\xxxxxxx.exe

Dave Weatherall

Process Id

I'm creating an Application object using White.Core.Application.Launch(). The object properties shows it is in 'yyyy' process id. However, after the main window loads, the actual window exists in another process Id ('xxxx') - according to Visual UI Automation Verify.

So when I'm searching for the window using the application object I created e.g. application.GetWindow("WindowName") - it cant' find it and the application breaks. The exception I'm getting says "no window found with name "WindowName" in 'yyyy' processId".

So I recon my question is how do I search across all processId's?

can't compile the default package

hi, after downloading the defaut package here on github I can't make it compile.
Frustrating...
I cannot open the solution in VS2010 neither. In both cases the problem is related to .nuget si my error below when I launch Build.cmd


Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.296]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 06/12/2012 17:12:54.
Project "C:\Users\julien\Desktop\White-master\White.msbuild" on node 1 (default
 targets).
Publish:
  C:\Users\julien\Desktop\White-master\src\.nuget\nuget.exe pack C:\Users\julie
  n\Desktop\White-master\src\TestStack.White\TestStack.White.nuspec -Version 0.
  1.0.0 -OutputDir C:\Users\julien\Desktop\White-master\build\Artifacts -BasePa
  th C:\Users\julien\Desktop\White-master\src\TestStack.White\bin\Debug
  Attempting to build package from 'TestStack.White.nuspec'.
  Could not find a part of the path 'C:\Users\julien\Desktop\White-master\src\T
  estStack.White\bin\Debug\'.
C:\Users\julien\Desktop\White-master\White.msbuild(45,5): error MSB3073: The co
mmand "C:\Users\julien\Desktop\White-master\src\.nuget\nuget.exe pack C:\Users\
julien\Desktop\White-master\src\TestStack.White\TestStack.White.nuspec -Version
 0.1.0.0 -OutputDir C:\Users\julien\Desktop\White-master\build\Artifacts -BaseP
ath C:\Users\julien\Desktop\White-master\src\TestStack.White\bin\Debug" exited
with code 1.
Done Building Project "C:\Users\julien\Desktop\White-master\White.msbuild" (def
ault targets) -- FAILED.


Build FAILED.

"C:\Users\julien\Desktop\White-master\White.msbuild" (default target) (1) ->
(Publish target) ->
  C:\Users\julien\Desktop\White-master\White.msbuild(45,5): error MSB3073: The
command "C:\Users\julien\Desktop\White-master\src\.nuget\nuget.exe pack C:\User
s\julien\Desktop\White-master\src\TestStack.White\TestStack.White.nuspec -Versi
on 0.1.0.0 -OutputDir C:\Users\julien\Desktop\White-master\build\Artifacts -Bas
ePath C:\Users\julien\Desktop\White-master\src\TestStack.White\bin\Debug" exite
d with code 1.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.39
Press any key to continue . . .

thanks in advance for any hint

White : Does not get dynamic column in listview object

Hi,
I have one problem while using white API, In my project there are many list view in that we are generating dynamic column when list item is selected.

when i focused on any row that row has two more column will generate My Problem is when I am able to select any row from list view ,
but newly generated column will not be accessible from the White API I am doing application in WPF windows.

Example : I have total 12 columns from that 10 columns are permanently visible and 2 column are visible when
user clicks on the row Also I have define custom template for the column, that column also not showing into ListView Object

let me know if any more clarification needed

Thanks
Gaurav Dhol

ListViewRow.DoubleClick operates on neighbouring item (2)

Oops - now I know what the closed button does, obvious really.
Sorry was my intention to close the current window not the issue.

I have made progress and know the mechanism behind the fault. I do not know how to solve it.

Consider a single listview 400 wide containing 9 columns of size 100.
That is you can not see the complete row you must scroll.
The system returns a Bound of 900 with Bounds.Centr() as 450 which is not inside my listview.
In my case inside another listview alongside, for others pure luck.

Details
DescendantFinder.cs

    public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition)
    {
        AutomationElementCollection collection = automationElement.FindAll(TreeScope.Descendants, automationSearchCondition.Condition);
        var enumerable = collection.Cast<AutomationElement>();
        return new List<AutomationElement>(enumerable);
    }

The automationElement.FindAll(..) is the procedure which returns the answer with the width of 900 for all the descendants

The listview (automationElement in above code) contains the correct width 400
the width values in collect, enumerable and method return value are all 900.

I went back to my problem, put back original code, and retried, I altered the column widths so as all were visible in listview.
Worked ok.

ListView Bounds has the correct width but all other parameters wrong
Descendants has incorrect width but all other parameters corrects

Looks easy but I don't know how to do this.

Dave Weatherall

TestStack assembly version problem with White.Repository build

White.Repository.dll isn't installed with the NuGet package, so I had to build it from the source included with the TestStack zip file. The build of White.Repository also builds and refers to TestStack.White version 1.0.0.0.

However, my test project uses the NuGet TestStack.White, which is version 9.2.0.11. When building my test project, it warns of the version mismatch and attempting to run it fails with an assembly load problem.

Until a new screen pattern replaces White.Repository, there ought to be an easier way to use White.Repository without each developer individually having to solve the version mismatch.

Condition and Reason why White Performance Boost / Cacheing does not work

Condition and Reason why White Performance Boost / Cacheing does not work

Short. The white cacheing mechanism does not work for items inside containers, specifically Panels.
A simple program, a few buttons, textboxes,.. littered on a form. No panels, no problems, cacheing works.

Details
A more sophisticated program would place buttons in one panel, textbox ... in another panel. In this case cacheing does not work.

The investigation is best done in WindowsSession.cs method Get. Here it obtains cached value, works perfectly, and then finds the actual item at the cached position (which is correct) and ensures the item satisfies the searchcriteria. The find procedure is the problem. The Get method calls GetAutomationElementFromPoint which in turn calls AutomationElement.FromPoint(location). The definition for this method (MSDN) "FromPoint returns the element in the logical tree that is closest to the root element". Big emphasis on closest. For instance I have found a button and a listview and these have been cached correctly. The FromPoint method finds the panels that contains the button and the panel containing the listview. FromPoint is doing its job as the panels are nearer to root than my items of interest.

I have messed around with a few erroneous ideas and discovered what a lot of people have already written that efficient UIAutomation navigation is difficult. Again emphasis is on efficient.

So I am reporting my findings without a solution.

David Weatherall

Check() method does not work for WinForm's CheckedListBox

If you have a WinForm application with a CheckedListBox and try to use the Check() method, it will not do anything if the item is currently selected, but not checked.

The reason is the following code in Win32ListItem.cs:
public override void Check()
{
DoCheck = true;
}

    private bool DoCheck
    {
        set
        {
            if (Checked == value) return;
            Select();
            if (Checked == value) return;
            Select();
        }
    }

Which will call:
ListItem.Select(), which does:
public virtual void Select()
{
if (IsSelected) return;
[...]
}

And because the item is already selected, it will not do anything (just return), and the result is that Check() does not do anything in the case above.

Not able to Enter text in textbox

Following is my piece of code. nonthing is entered in text box but the code doesnt give any exception.


Window main = Application.GetWindow("MainWindow");

TextBox box = main.Get(SearchCriteria.ByAutomationID("theID");

box.BulkText = "My simple Text";

//or

box.Enter("Some Text");

Left handed mouse use -follow up

I'm left handed user of a mouse, my wife isn't. If I use her laptop I'm banned from changing the mouse buttons because as an expert( = she can use ms word) she can't change it back.
So the following is a piece of code on top of the Left Handed Mouse use mods which sets White Mouse up by reading the system settings for the mouse button and setting White accordingly.

    using White.Core.Configuration;

    namespace TestProg
    {

        public class TestProg
        {
            public Window mainWindow;

            public void StepInitAppAndMainWindow()
            {
                // Note. Do not add using statement for System.Windows.Forms
                CoreAppXmlConfiguration.Instance.InvertMouseButtons =
                    !System.Windows.Forms.SystemInformation.MouseButtonsSwapped;


                 application = Application.AttachOrLaunch(processStartInfo);// just to show where above code should live

Notes.
This overwrites the entry in app.config. If you use the above, the entry in app.config is redundant and can be removed.

Dave

Find window should retry

FInding windows should also automatically retry for a timeout period so tests do not have to put Thread.Sleep() or implement their own retry

ListViewRow.DoubleClick operates on neighbouring item

Newbie

I have 2 listviews left and right.
with the following snippet

    public void NavigateDownLV(ListView listView, string text, bool eqOrContains)
    {
        if (listView != null)
        {
            foreach (ListViewRow lvr in listView.Rows)
            {
                if ((eqOrContains && lvr.Cells[0].Text == text)
                    || (!eqOrContains && lvr.Cells[0].Text.Contains(text)))
                {
                    listView.Focus();
                    lvr.Select();
                    lvr.DoubleClick();
                    System.Threading.Thread.Sleep(2000);
                    break;
                }
            }
        }

    }  // navigate

Operating on my left list view
lvr .Select works
lvr.DoubleClick works on the right hand list view, wrong, should be left listview.

In Uitem.cs (this contains original code and my new version)

    public virtual void DoubleClick()
    {
        actionListener.ActionPerforming(this);
        //PerformIfValid(() => mouse.DoubleClick(Bounds.Center(), actionListener));       old code
        PerformIfValid(() => mouse.DoubleClick(ClickablePoint, actionListener));        // new code
    }

The Bounds was incorrect the width was too large and the Center() was in the wrong listview.
Did not understand how Bounds was set. So followed example of Select() code in ListViewRow.cs and used ClickablePoint.

As I have only used TestStack.White for a few days I know this is not the right solution ( why is the Bounds wrong ? ) but works in my case

David Weatherall

Move wait hook into retry loop

Currently it is outside of the waitwhilebusy loop, it should be moved inside the loop and the hook should simply be .IsBusy() and the user doesnt have to implement any retry logic

Menu buttons clicks don't work.

I have a menu bar that has buttons (not menu items).

Button about = _mainWindow.Get(SearchCriteria.ByText("About My App"));
about.Click();

This clicks at the upper left hand corner of my screen no matter where the app is.

Listview with large number of rows, scrolled, speed up mods

Initialy mentioned in ListViewRow.DoubleClick operates on neighbouring item (2)
Description not good and no pull request provided. So set as new issue with pull request.

For listviews with large number of rows. Operating on page x of listview. Either Multiselect on this page (my problem) or single select and then single select on say next row. Very slow. Speedup (estimate factor 2 to x) mod.

Gets worse, just googled and found exactly the same issue and solution reported on CodePlex shown below (Note Date) http://white.codeplex.com/discussions/61733


pine1981
Jul 7, 2009 at 4:35 PM
Edited Jul 7, 2009 at 4:36 PM
Hello,

I would like to suggest some modification to Core.UIItems.Scrolling.ScreenItem.MakeVisible() method. It does scroll grid up to first element and then back even if row is currently visible. That reduces grid row walkthrough (i.e. foreach cycle on all rows, accessing row.Cells[index] at each iteration) dramatically (2 rows per second). I suggest to swap two blocks of code which are currently:

...code omitted as in pull request

In that case grid does not scroll up at each row processing.

What do you think on possible problems after that change?


On further study, a slight alteration, pine suggests swapping two blocks, this pull requests copies one block so that the same test brackets scrolling to first element. I believe this is needed.

Dave Weatherall

Use UIA Com Wrapper

UIA Com Wrapper is an updated open source COM UIA wrapper which supports more UI automation patterns than the .net framework version.

By switching we can support virtualisation patterns and other new patterns

White.Core.UIItems.UIActionException: Window didn't respond... ---> System.ComponentModel.Win32Exception: Access is denied.

I keep getting this:
White.Core.UIItems.UIActionException: White.Core.UIItems.UIActionException: Window didn't respond, after waiting for 10000 ms ---> System.ComponentModel.Win32Exception: Access is denied.

System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
System.Diagnostics.Process.WaitForInputIdle(Int32 milliseconds)
System.Diagnostics.Process.WaitForInputIdle()
White.Core.UIItems.WindowItems.Window.WaitForProcess()
White.Core.UIItems.WindowItems.Window.WaitWhileBusy()
White.Core.UIItems.WindowItems.Window.WaitWhileBusy()
White.Core.UIItems.Actions.Action.Handle(Window window)
White.Core.UIItems.WindowItems.Window.ActionPerformed(Action action)
White.Core.InputDevices.Mouse.ActionPerformed(ActionListener actionListener)
White.Core.InputDevices.Mouse.Click(Point point, ActionListener actionListener)
White.Core.UIItems.UIItem.PerformClick()
White.Core.UIItems.UIItem.PerformIfValid(Action action)
White.Core.UIItems.UIItem.Click()

I get this when I click on a menu item that exit the application. According to http://white.codeplex.com/discussions/80049 the problem is that the clicking trigers ActionPerformed to be run which will wait for the application to be not idle. However, the application will at some point exit, and the WaitForInputIdle will fail because it waits for an application that does not exist.

Anyone else experiencing this problem? I have two automated test servers. One of them gives me this all the time, but the other one does not. The one with the problem runs Windows Server 2003 and has a single processor (I think), and the other has dual processor and Windows Server 2008.

WhiteException when trying to get a disabled ComboBox

Hi,

I am running myWindow.Get(SearchCriteria.ByAutomationId("myName")) to find a combobox, and I get a WhiteException as shown below. This used to work, but does not anymore.

It looks like the problem is that the combobox is set to disabled. The command works okay when the combobox is enabled.

It looks like the problem is that White tries to "Expand" the combobox" (maybe this part is new), and that fails if the combobox is disabled.

White.Core.WhiteException: Error occured while geting ControlType=combo box,AutomationId=cbxComponents ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Automation.ElementNotEnabledException: The operation is not allowed on a nonenabled element.
at MS.Internal.AutomationProxies.WindowsComboBox.System.Windows.Automation.Provider.IExpandCollapseProvider.Expand()
at MS.Internal.Automation.UiaCoreApi.CheckError(Int32 hr)
at System.Windows.Automation.ExpandCollapsePattern.Expand()
at White.Core.UIItems.ListBoxItems.ComboBox.MakeActionReady()
at White.Core.UIItems.ListBoxItems.ComboBox..ctor(AutomationElement automationElement, ActionListener actionListener)
at White.Core.UIItems.ListBoxItems.WinFormComboBox..ctor(AutomationElement automationElement, ActionListener actionListener)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, ref StackCrawlMark stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at White.Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, Type itemType, ActionListener actionListener)
at White.Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, ActionListener actionListener)
at White.Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, ActionListener actionListener, Type customItemType)
at White.Core.Factory.PrimaryUIItemFactory.Create(SearchCriteria searchCriteria, ActionListener actionListener)
at White.Core.UIItems.Container.NonCachedContainerItemFactory.Find(SearchCriteria searchCriteria)
at White.Core.UIItems.Container.ContainerItemFactory.Get(SearchCriteria searchCriteria, ActionListener uiItemActionListener)
at White.Core.Sessions.NullWindowSession.Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener)
at White.Core.UIItems.Container.CurrentContainerItemFactory.Find(SearchCriteria searchCriteria, WindowSession windowSession)
at White.Core.UIItems.UIItemContainer.<>c__DisplayClass8.b__4()
at White.Core.Utility.Retry.For(Func1 getMethod, Predicate1 shouldRetry, TimeSpan retryFor, Nullable`1 retryInterval)
at White.Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria)
--- End of inner exception stack trace ---
at White.Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria)
at White.Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria)

The script doesnt wait till the timeout specified in the Busy timeout section of app.config

Hi Friends,

I am facing an issue which has stopped me from moving ahead.
I have specified a custom Busytimeout in my app.config file of My automation solution.
The app.config looks like:-

?xml version="1.0" encoding="utf-8"?
configuration
configSections
section name="UserLayouts" type="Reflex_White.UserLayouts,Reflex_White"
sectionGroup name="NUnit"
section name="TestRunner" type="System.Configuration.NameValueSectionHandler"
/sectionGroup
sectionGroup name="White"
section name="Core" type="System.Configuration.NameValueSectionHandler"
section name="UIItemId" type="System.Configuration.NameValueSectionHandler"
/sectionGroup
sectionGroup name="Bricks"
section name="Bricks" type="System.Configuration.NameValueSectionHandler"
/sectionGroup
/configSections
appSettings
add key="ReflexPath" value="C:\2.4.0.5\Bank.Reflex.UI.Shell.exe"
add key="Environment" value="Prod HA"
add key="ReflexSnapshotPath" value="U:\Reflex\Snapshots"

/appSettings
UserLayouts
UserLayoutCollection
Layout name="layout_max.xml" NumberOfReports="8"
Layout name="Julien_Layout.xml" NumberOfReports="11"
Layout name="DefaultLayout_duclose.xml" NumberOfReports="9"
Layout name="DefaultLayout_New.xml" NumberOfReports="14"
/UserLayoutCollection
/UserLayouts
White
Core
add key="WorkSessionLocation" value="."
add key="PopupTimeout" value="50000000"
add key="SuggestionListTimeout" value="30000000"
add key="BusyTimeout" value="50000000"
add key="UIAutomationZeroWindowBugTimeout" value="50000000"
add key="TooltipWaitTime" value="3000000"
add key="DragStepCount" value="4"
/Core
UIItemId
/UIItemId
/White
Bricks
Bricks
add key="RecheckDurationInMilliseconds" value="101"
/Bricks
/Bricks
NUnit
TestRunner
add key="ApartmentState" value="STA"
add key="ThreadPriority" value="Normal"
/TestRunner
/NUnit

configuration

(Have removed the angular brackets from the above xml as it was not showing up)

Even after increasing all the timeouts such a drastically, it times out after waiting for very less amount of time saying:-
Window didnt respond after waiting for 50000000 ms

But it didnt actually wait for 50000000 ms

Can anyone help me out on this please

Thanks in advance

Add virtualisation support

Once we have upgraded to the UI Automation Com wrappers we will be able to support the virtualisation patterns in windows 7/8.

Mods for Left Hand Mouse

I use the mouse left handed (I am actually right handed ........) so changing to a right handed mouse for testing is a pain. So modifications for left handed mouse.

In the app.config an extra line

    <add key="MouseRightBtnIsTrueOrLeftBtnIsFalse" value="false"/>

false is for left hand mouse.
For right hand mouse set to true or just leave line out as default is for right hand

Example of app.config

<sectionGroup name="White">
    <section name="Core"    type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
</configSections>

<White>
    <Core>
    <add key="LogActions" value="false" />
    <add key="WorkSessionLocation" value="."/>
    <add key="PopupTimeout" value="5000"/>
    <add key="MouseDelayForTooltip" value="0" />
    <add key="SuggestionListTimeout" value="3000"/>
    <add key="BusyTimeout" value="5000"/>
    <add key="WaitBasedOnHourGlass" value="true"/>
    <add key="MouseRightBtnIsTrueOrLeftBtnIsFalse" value="false"/>
    <add key="UIAutomationZeroWindowBugTimeout" value="5000"/>
    <add key="TooltipWaitTime" value="3000"/>
    <add key="DragStepCount" value="4"/>
    </Core>
</White>

Unix diff

                        Mouse.cs  
81a82,101
>         private static int RightBtnDown
>         {
>             get {return (CoreAppXmlConfiguration.Instance.MouseRightBtnIsTru
>         }
> 
>         private static int RightBtnUp
>         {
>             get {return (CoreAppXmlConfiguration.Instance.MouseRightBtnIsTru
>         }
> 
>         private static int LeftBtnDown
>         {
>             get { return (CoreAppXmlConfiguration.Instance.MouseRightBtnIsTr
>         }
> 
>         private static int LeftBtnUp
>         {
>             get { return (CoreAppXmlConfiguration.Instance.MouseRightBtnIsTr
>         }
> 
84,85c104,105
<             SendInput(InputFactory.Mouse(MouseInput(WindowsConstants.MOUSEEV
<             SendInput(InputFactory.Mouse(MouseInput(WindowsConstants.MOUSEEV

---
>             SendInput(InputFactory.Mouse(MouseInput(RightBtnDown)));
>             SendInput(InputFactory.Mouse(MouseInput(RightBtnUp)));
103c123
<             SendInput(InputFactory.Mouse(MouseInput(WindowsConstants.MOUSEEV

---
>             SendInput(InputFactory.Mouse(MouseInput(LeftBtnUp)));
108c128
<             SendInput(InputFactory.Mouse(MouseInput(WindowsConstants.MOUSEEV

---
>             SendInput(InputFactory.Mouse(MouseInput(LeftBtnDown)));





                    CoreConfiguration.cs
28a29
>         bool MouseRightBtnIsTrueOrLeftBtnIsFalse { get; set; }





                    CoreXmlConfiguration.cs
34a35
>             DefaultValues.Add("MouseRightBtnIsTrueOrLeftBtnIsFalse", true);
129a131,136
>         public virtual bool MouseRightBtnIsTrueOrLeftBtnIsFalse
>         {
>             get { return Convert.ToBoolean(usedValues["MouseRightBtnIsTrueOr
>             set { SetUsedValue("MouseRightBtnIsTrueOrLeftBtnIsFalse", value)
>         }
> 

David Weatherall

KeyboardTest.ShouldSetTheValueOfATextBox fails for non-US keyboard for special keys

Hi,

I just tried to run the uitests with the latest code. It looks like there is an issue with the keyboard tests/code. The failing test tries to send the values "[]" using the keyboard, and that fails because the current keyboard code does:
short key = VkKeyScan(c);
if (c.Equals('\r')) continue;

            if (ShiftKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.SHIFT, false);
            Press(key, false);
            if (ShiftKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.SHIFT, false);

But on my keyboard (laptop with non-US keyboard), shift 8 does not give "[", but "(". On my keyboard Fn + 8 will do the trick to type "[".

I guess the current code assumes that we are using a US keyboard. Is that right?

Test failing when

  1. Test Failure : White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheVa lueOfATextBox
    String lengths are both 9. Strings differ at index 1.
    Expected: "[];',./-" But was: "89;',./-"
    ------------^

at White.Core.UITests.InputDevices.KeyboardTest.EnterAndAssertValueOfTextEntered(String stringToType) in c:\DATA\GitHub\White\src\TestStack.White.UITests\InputDevices\KeyboardTest.cs:line 81
at White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheValueOfATextBox() in c:\DATA\GitHub\White\src\TestStack.White.UITests\InputDevices\KeyboardTest.cs:line 40

Introduce Screen Pattern to White

The White.Repository project will be eventually deprecated in favour of a lightweight screen pattern and bootstrapping classes available in TestStack.White itself.

public interface ITestApplication
{
     void Start();
     void Close();
}

// Then the following implementations:
WpfApplication : ITestApplication
WinformsApplication : ITestApplication

class AppScreen<T> where T : ITestApplication
{
    public T Application { get; }
    public Window Window { get; }
}

These classes help to get the application running and have a handle to the starting screen.

Application.GetWindows() returns nothing

For some reason, I am unable to get the handle of the window I would like to interact with.

my code:

Application _app = Application.Launch(@"C:\Program Files\xxxxx\Client\xxxxx.exe");

// var windows = _app.GetWindows();

Window _window = _app.GetWindow(SearchCriteria.ByText("xxxxxxxx xxxx xxxxx"), InitializeOption.NoCache);

The application launches successfully but the GetWindow fails. When calling GetWindows to see if any windows are returned, the count is zero. What am I doing wrong?

White is not available compiled with "Any CPU" as the platform to provide 32/64 bit support

White currently builds 32 bit dlls, and any application built off of them must also be compiled with x86 as the platform -- I would like to be able to offer a single 32/64 bit solution to my end users by compiling my application against "Any CPU" which requires White to also be compiled using "Any CPU" as the platform

I found this issue while running my automation on a 64 bit machine and trying to type text in the filename field of a native File Save As dialog while my application was compiled against "Any CPU".

Observed behaviour:
White clicks in the filename field but silently fails to type text for the filename.

WPF controls not identified while running the C# script+white

I have been using white to automate our WPF application.
But a strange issue I am facing is that there are several Group controls inside the main window of my application
And in the bottom-most group there are the actual elements, like combobox, text box etcc..
Now, if I launch the application manually and try to identify the combobo, text box etc..using UIspy it works fine
But, when I run the same thing using C# script + white...none of the controls get identified
It has totally bugged me off
Any immediate help in this area would be highly appreciated
Thanks,
Nishant.

Spinner.get_Value() throws WhiteException

Hi again

The application I'm testing has one spinner with a range of values. When I try to set or get its Value I get following WhiteException:

WhiteException: Error Invoking SpinnerProxy.get_Value ---> White.Core.WhiteAssertionException: Could not find Raw Spinner Element containing the value

Current implementation of Value property gets or sets it based on ValuePattern so it fails when control has implemented RangeValuePattern. I worked this issue around with try/catch block - maybe you'll find cleaner solution and put it into code.

Best regards,
-marcin

RunUITests.cmd should run UI tests for WinForm etc, but currenly only for WPF

The current UI tests are designed so that one test can run on multiple GUI technologies (WinForms, WPF, and Java). However, when running RunUITests.cmd each test will only be ran for one class of user interface. This is for the default user interface, which is WPF unless the test was made for WinForms or java only.

This makes it very easy to make a fx for one platform that breakes the other platforms.

Instead, we should run all the tests for all platforms. Only then we can be sure that everything is okay.

Any idea how to fix this?

DataGridView in WinForms: Select() not working

Hi,

I have a DataGridView in a WinForms application. When i use the Select() method on a row, nothing happens.

It works okay in the application itself, so there is something wrong in White.

Furthermore, why is there no IsSelected property on the row class for the datagridview?

Window.ModalWindow

Hi

Could you tell me how shall I use ModalWindow functions? In Window class these methods are marked as abstract - they are implemented in child classes however I don't know at which point and how particular window shall be recognized as i.e. Win32Window or WinFormWindow.

Appreciate your help,
Marcin

"speed up" white

Hello,

I enjoy working with this tool, but it would be nice if there was a way to 'speed up' the operations. Seems to take a long time for white to enter text in text boxes within an application.

Cannot operate MPF checkbox

When I try to check or click an MPF checkbox in a WPF list view, I met error with "A first chance exception of type 'System.InvalidOperationException' occurred in UIAutomationClient.dll"

But I can get the checked status of the checkbox, true for check and false for unchecked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.