I am working on some UI automation for verify tab order of our WPF application. I was wondering if there was a Windows API or UIA API for getting the current tab order of the application under test. My UI automation is written in C# but I am more then willing to do some pinvokes to make this work.
Here is some clarification based off of #CodyGray's comment. My company's has certain tab orders that we want to rarely change if ever because our users are so used to these tab orders as part of their workflow (they operate the user interface faster than it can update via these tab orders...). The current way I am doing this is through keeping a list of the tab orders then using SendKey to tab and check which control has focus. I then double check if the focused control is the control I expect it to be from a hard coded list. I would prefer to actually ask the application what it's tab order is going to be instead of using SendKey which could send tabs to the incorrect window based on what has focus.
Related
I want to create an application that will run in the background and track the click actions of the mouse, and when the user clicks on an external WPF or Winforms app, the background app should be able to detect the clicked control and display its ID/name/text.
I'm not sure if this is possible, but since there are automation tools that can perform similar actions, I think it should be possible. For example, with some tools it is possible to get the "window" object using the external app's PID, and then the controls (for example a button) can be accessed by providing the ID of the control. However in my case it is the other way around. I need to get ID/name/text of the control the user has clicked.
I can obtain the mouse position using windows Hook
I can obtain the hwnd and Process ID of the window the user has clicked
So is it possible to obtain the information about the element clicked? Any help and advice is appreciated, thanks in advance.
We have an existing application source code which is developed using WPF and WCF. It's working fine for every user except for one particular user.
There is a functionality in application like on click of check box the button should be enabled on UI. only this specific functionality is not working for the specific user.
Please help me if anybody have an idea regarding WPF controls behaviour or something
We verified about the roles he has to access the application and everything looks good as others but still there is an issue.
Actually on click of checkbox the button should be enabled for the user to access it.
This might just be a small quirk. But I've built a small windows form application with multiple tabs.
I have a feature that allows users to "load" the entries in each of the tabs by opening a json file. This lets them avoid manually inserting the data. At the same time, I have a "check" to make sure that all required fields have been populated.
What I've found is that even if the load process is successfully populating all the right fields, the user still needs to select each tab (even though they are already filled), in order to avoid hitting the flag.
Hopefully, this makes sense. Right now, my work around is to have the program flip through each tab automatically upon "load", but it seems strange that winforms can't detect a text box has been filled unless the tab is viewed.
Any advice?
Some events only fire when the control is visible. This sounds like what you should do is decouple the text entries from the control and store them in another object which fires off the filled events then do data binding to those entries.
This has the nice benefit of decoupling the UI from the data storage (always a nice thing) as well as freeing you from the vagaries of the .net UI system (both winforms and wpf have 'interesting' quirks like the above which assume specific behavior preferences).
In Windows Speech Recognition (WSR), there is a command called "Show Numbers" that pulls up transparent boxes over every clickable item on the active window.
I'm not looking for a full program but more of what identifies clickable items on an active screen, if something like that even exists. I hope this question makes sense. Thank You! If it's important, I'm using c#.
While I'm not familiar with WSR, UI items can be identified through the UI Automation framework. It's able to see controls on windows and able to interact with them. The primary intent is for accessibility purposes(Screen readers and the like) but it has also been coopted for UI Automation tasks and is the backbone behind portions of the Coded UI Framework. http://msdn.microsoft.com/en-us/library/ms747327.aspx
I'd like to be able to do following actions within another application:
to change Tabs
to Copy text from within a TextBox
to click on a Button
to enter text into a TextBox
to select DropDownList element
Right now I'm using separate methods such as:
mouse_event() to change mouse coordinates and click on a button
another mouse_event(LeftMouseClick followed by the RightMouseClick) to copy a text within a TextBox
Clipboard.GetText(System.Windows.Forms.TextDataFormat.Text) to Copy what's inside the clipboard
SendInput (for each key) - enter the text into a TextBox
Disadvantages of this approach are:
(not crucial) PC becomes unusable (you can't work while script is running)
I have to know exact pixels (read - position/coordinates) of EVERY element within an app
slow execution time (each key has to be typed separately)
I'm looking forward to create an application which can click on a TextBox/Button/List without the need of having exact coordinates of these elements.
Is such task possible with C# WinForms? My current approach works but it has it's flaws.
Any advice?
Read about Mutex. If you plan on scale-ability, read about network communication (for example, the TCP protocol. TcpListner, and TcpClient).
This sounds like a job for UI Automation. I have only used it to get text from another application, but it has functions to activate controls by name or to navigate the control tree if there is no name.
You can get text and interact with controls using AutomationElements that you find using patterns or navigating the control tree.
There is a complete framework for doing exactly this kind of thing, and it's called the UI Automation Framework
Here's some examples on how to use it.
And you can also apply this technique to generic windows's using the UI Spy to determine the automation elements.