teststack / white Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED - no longer actively maintained
License: Other
DEPRECATED - no longer actively maintained
License: Other
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
Test failing when
[];',./-" 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
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
i need to get the parent of a child element . As the parent does not have a unique property or name by which i can find it . Please help
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");
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
Currently the Repository project supports components, add support in white directly once the new AppScreen functionality has been completed
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.
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.
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
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.
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
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.
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
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.
Add support to automate Windows 8 applications
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
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
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:
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
at White.Core.UITests.UIItems.ListBoxItems.ComboBoxTest.Select() in c:\DATA\G
itHub\White\src\TestStack.White.UITests\UIItems\ListBoxItems\ComboBoxTest.cs:
line 54
at White.Core.UITests.UIItems.TextBoxTest.EnterText() in c:\DATA\GitHub\White
\src\TestStack.White.UITests\UIItems\TextBoxTest.cs:line 27
Tests Not Run:
Once we have upgraded to the UI Automation Com wrappers we will be able to support the virtualisation patterns in windows 7/8.
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?
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?
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
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, Predicate
1 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)
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.
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.
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
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?
Improve CI build so it runs all the UI Tests as part of the build
Get running on a CI server
FInding windows should also automatically retry for a timeout period so tests do not have to put Thread.Sleep() or implement their own retry
I followed the guide here http://www.codeproject.com/Articles/289028/White-An-UI-Automation-tool-for-windows-applicatio
But click and key press doesn't work
For example, below code clicks the 1 button in caculator, but 1 is only highlighted, not really clicked.
//Button with Numerical value 1
White.Core.UIItems.Button btn1 = _mainWindow.Get<White.Core.UIItems.Button>
(SearchCriteria.ByText("1"));
btn1.Click();
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
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
[];',./-" 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
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
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
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
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?
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
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
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.
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
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
This happens due to the fact that UIItem.AsContainer passes private actionListener variable which will be null when the item has been instantiated be the proxyGenerator
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
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
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.
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?
Waiting on the cursor or the UI thread being blocked is not great. Give some guidance about ways that this problem can be solved.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.