This is about testing a desktop application. I have been trying to click a hyperlink on an embedded browser of a Windows form. I could move the mouse anywhere if the component (buttons, or whatever) is part of the form, but elements inside the browser, i can't seem to control at all....sigh.....yes, I could move the mouse if I use the screen coordinates but I plan to control the embedded browser using Watin, etc..without opening a new IE....Using Microsoft's UISpy tool (when I hover the cursor to the link..it shows a Pane ControlType)....the hyperlink is part of the tree structure but only the name property is available...some of the parent's properties are blank....
I tried extending the example from the link below
http://archive.msdn.microsoft.com/uiautomation
and this is where i'm stuck (I have tried FindChildByName and other related methods too...sigh..no luck):
var commontab=AutomationElement.RootElement.FindFirstChildHavingDescendantWhere(new[] { new PropertyCondition(AutomationElement.NameProperty, "Search")});
Mouse.MoveTo(menutab.GetClickablePoint().ToDrawingPoint());
Mouse.Click(MouseButton.Left);
Somehow the mouse cannot find the 'Search' hyperlink...sigh...please guys...any ideas??
Would it not be a simpler idea to split this into 2 testing strategies? The first is testing the desktop UI, buttons etc. as you are. The second is to test the html which is to be placed within the embedded browser frame.
You shouldn't be testing that the embedded browser works, that's Microsofts job. The only testing that you may want to do on the frame is to ensure that it's content is loaded, that the call is to the correct (internal) url etc.
Related
I am currently making an application for someone using an eyegaze system which tracks his eye movements to the screen and uses it as a mouse. When he hovers over a button for a little bit (.6 seconds) it sends a mouse click to the screen where he was hovering. We have an embedded browser within the application that reading the info on the browser is much more important than selecting anything on the browser and with the nature of his device, browsing is selecting if he hovers for too long. How would I go about making the content within the browser read-only, or not able to be selected?
Have you tried putting a transparent panel over the embedded browser? Would be like placing a piece of glass over a book. You can still read it, but you won't be able to touch(select) the page.
I need to automate a workflow and tried to rely on teststack white and UIA Verify to find the buttons in another application.
However when I try to identify the buttons I was greeted with just empty name properties for the controls inside the window I need to control (see attached screenshot).
The controls are apparently of type Custom.
I want to be able to press buttons and enter text into textboxes as well as check a checkbox.
Is there a way? Can I access them via for example an index (e.g. button = third control in window)?
Edit: As requested a screenshot from inspect.exe
Would you mind taking a look at those controls with Inspect.exe and posting a screen shot of the properites? You might be able to find another unique property on them to identify it with. Inspect.exe can be found C:\Program Files (x86)\Windows Kits\8.1\bin\x64\inspect.exe.
With White you wont be able to get a collection of all the buttons but with raw ui-automation you will be able to get a collection of the AutomationElements using FindAll.
Here is an example of how to get all controls of a certain type.
Retrieve Multiple UIItems ByClassName
Edit:
So after looking at the updated image from inspect I am afraid the application you are trying to automate didn't expose their application to ui-automation properly. I was certain that it wasn't exposed properly before but I was hoping they may have accidentally exposed some properties. I have seen this before with some 3rd party controls for VB6. It would be possible using the technique I linked above to get all the controls with a name of "" but then you would have to use the bounding rectangle property to move your mouse to the correct position and click (if that property is reporting the correct position) since I would wagger the invoke pattern is not supported. If you have access to the source code you could implement these properties and pattern.
i have create a few WPF applications in visual studio, and now i would like to create a final application to run all of the created apps in the final application. i would like to know how i can create a layout that displays the apps that are running inside the final app as buttons that can be clicked and cause the app to expand and allow the user to work on that app and then when finished return back to the final app and see the other apps to choose from. I imagine it would look like a Google chrome blank page that allows you see your familiar webpages and click on them to load them up. Any help or advice on what i should focus on to implement this would be much appreciated.
Thank you for taking the time to read over this.
Consider using a VisualBrush this takes other WPF UI (your "apps") and uses their UI as a brush for another UI element.
Raj Kumar has a simple article called Visual Brush in WPF for details.
The bit you probably want is at the bottom where he shows you rendering a controls content in another control. The magic being binding the controls visual to the element name whos UI it should render.
I'm developing a bunch of user controls which do different things - like a maintenance screen, enquiry screen, report screen that sort of thing. Each screen has a dedicated purpose and a single user control holds all the functionality for the one screen.
I'm using avalondock and can place these user controls into LayoutDocuments. This creates a separate tab for each screen/user control. I've got a menu system setup so users can choose which screens they need access to. For each new screen I create a new LayoutDocument, add the appropriate control to it, then add the LayoutDocument to the Docking panel's children.
This is all working fine.
Avalon dock also has the feature of being able to drag out the layout document and make it float - you can also dock it somewhere else in the app if you wish.
I'd like to take this concept one step further: Being able to say right click on a layout document and choose "Make external window" (i'll work out the exact wording later). The effect of this action would be to create a new application with it's own icon in the task bar; being able to alt-tab between it and other apps;
Kind of like when you're in say Excel editing a document and you then open up a second instance of excel. In Windows 7 you get two excel icons in the task bar (one behind the other), and you can alt-tab between them.
This is nearly the behaviour that i'm after. However the second app isn't a full blown copy of the first; it has only the one user control that the user selected.
This is where i'm stuck and would like a bit of guidance.
I'm thinking that i'll probably need some kind of shell app where I can pass in the user control that I want. The shell would act as a window with title, X, minimising etc; the user control would then be the sole content of that shell. Use process.start to create new process and launch ?
Ideally i'd be able to pass in the same control in the same state as the user is currently viewing - so if for example they are part way through editing some customer record in a maintenance screen, then choose the "external window" option, that same customer record would appear in the new window.
Has anyone done something similar or offer advice if i'm on the right track ?
I think I know how to create a shell app but not sure on passing a user control to it dynamically. I'd like to avoid creating different shell apps for each user control.
No need to start a new process for that scenario.
Just create a new Window add your UserControl at runtime and remove the UserControl from the DockingManager. Make sure the Window has ShowInTaskbar set if you want it to show up there.
To get the command to undock the UserControl as a seperate Window you just have to restyle the ContextMenu to incorporate your command (take a look at the VS2010 theme and how the ContextMenu is styled there VS2010 theme.xaml).
I am doing a UI automation for a WPF application using the Microsoft UI Automation library and it works well.
However my app has four screens in a TabControl. Even when I click the tab item through code its child control tree isnt populated. The only control I can see is the "thumb" Control. Same happens when I see the control tree with UISpy.
However if the window is clicked then all the controls appear. As a Workaround I am simulating a mouseclick through code and it works. I wanted to know if there is some better way of doing it.
I ran into a problem similar to this. What was happening was some data was being retrieved on threads and the controls were not generated at the point automation peers were generated. I would suggest if you have access to the code base for the application you are attempting to automate looking into whether threading is being used. In my specific case it was because BeginInvokes were used to retrieve the data, I switched them to Invokes and it worked fine.
Also from what I could tell the reason the controls were being show on mouse over was because the tool tip generated a popup and caused the automation peers to be updated.
Why don't you click the control using mouse events if that is what works.
(Now, if you still are having that problem..)
How to simulate Mouse Click in C#?