c# ui automation [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
i am trying to automate the gui in c# .Is this same as browser automation .how can i start ui automation

If you are using WPF, Microsoft has a very detailed UI Automation library.
http://msdn.microsoft.com/en-us/library/ms747327.aspx
I had a look around but I couldn't find an equivalent for WinForms.

You can use Microsoft's UI Automation library, but it isn't much fun. "White" is a better alternative... see: http://www.codeplex.com/white
EDIT:
New url to "White" project as it was moved to TestStack on GitHub: https://github.com/TestStack/White

WiPFlash is good, easy to use, open source wrapper on top of Microsofts UI automation library. But they're limited by the underlying Microsoft Automation structure.

FlaUI is a good alternative to "White" library, based on native UI Automation libraries from Microsoft.

9 Years later Appium is a good option, also a reference side from Microsoft, since CodedUI is obsolet.
Microsoft build the WinAppDriver for Appium. You can also just use the WinAppDriver to test your gui. you need Appium, just if you want to do contionouos integration.
Differences:
Teststack.White is an efficient Testframework. It doens´t need as much time as WinAppDriver (Appium) to go through the tests and its very easy to implement in your testproject. But the support isn´t as good as WinAppDriver. Teststack.White as example still doesn´t support UWP (maybe no one want to develope with UWP :P ). On the other side, you need Windows 10 or Windows Server 2016 to work with the WinAppDriver. Both have an easy implementation of tests, but you need to set some JSON-Values, to get a http-connection with the WinAppDriver.
At least the WinAppDriver with Appium has much more possibilities, but TestStack.White is easy implemented.

Be careful if your GUI is using any 3rd party Windows controls, like Devexpress controls, or Telerik controls.
MS UI Automation would have difficulties to locate those fancy grids, lovely menus and pretty icons.
Talking about TestStack.White, it's using MS UI Automation as the cornerstone, so it would face the same problem locating detailed GUI elements.
You will know when you need to manipulate the grid by row but UI Automation or TestStack.White could furthest only return you the table object, then you will find your R&D efforts before the project starts were all wasted. That's how I learned that lesson, but now I am the expert.

http://msdn.microsoft.com/en-us/library/ms747327.aspx like Alastair Pitts pointed out can be used. From my knowledge it should be good for any automation tasks - as long as Windows recognizes the control your application uses as standard controls or controls that have automation support. Which should be the case for just about all major control vendors. And defnitely MFC, Win32, WinForms and probably WPF and Silverlight as well.
You can get an idea of what you are up to (against) by firing up Spy++ and having a look at what it displays.
You might also want to listen to the other ideas, using Tools like White (opensource) or Rannorex (which is commercial).

Related

Get data from FarPoint Spread control running in another application

I'm attempting to write a application in C# utilizing the Microsoft UI Automation framework. The application to be controlled uses a component called "FarPoint Spread". It's easy enough to automate the rest of the application (e.g. its WinForms controls), but I can't seem to do anything with the FarPoint Spread control.
I'm still very green when it comes to programming. I've got just the basics of C# and UI automation down. Just need someone to point me to the information I need to have to automate this Spread component (if that's even possible). Thanks!
The problem is the grid rendering in Spread is written probably using custom code, and it's not equipped with what UI Automation expects.
I have tested the Sample Explorer provided by GrapeCity here (http://spread.grapecity.com/Pages/Demos/) with UI Automation's Inspect tool, and once you get to the data grid itself, there's nothing shown in Inspect.
There's also this topic in GrapeCity's forums:
Is Spread even supported in coded UI test which clearly states (2 years ago) it's not supported (as you known VS Coded UI also uses UI Automation as the underlying technology).
So, I guess it's not possible to automate Spread using UI automation (maybe they have their own system, you'd have to contact them).

Using WPF on XP embedded for simple GUI

I've got a simple and clean GUI to do for windows XP embedded, but I'm very new to C#.
Many topics I've found discussing WPF on XPE seem to be dating back to ~2007, so I'm here hoping for current up-to-date information.
Basically, how well supported would WPF be for this task? Are there circumstances which makes this a very bad design path? (what .net version?)
The app will be a kiosk mode gui which will contain some simple buttons, textfields and maybe a drawing canvas element.
It should at least be possible for you to get .Net Framework 3.0 installed on XPe (http://msdn.microsoft.com/en-us/library/bb417255%28WinEmbedded.5%29.aspx). However, depending on the performance you've got available and the kind of UI (if its simple enough), you might opt to choose WinForms instead of WPF.

Ribbon based GUI - Winforms vs WPF

For a new project, I'm writing an administrative tool as a client software.
So far, I've only written some small winforms application with a 'old-lookin' GUI.
I'm thinking of something fresh, new looking like ribbon based design.
The questions that come into my mind are:
1) Should I prefer WPF over Winforms for a ribbon based GUI(though I've never touched WPF before)
2) Are there any recommendations for free ribbon controls? I've found out that Microsoft seems to have this ribbon license, but I still don't get it. Do they offer a full functional ribbon based control? If yes, Winforms or WPF?
Visit http://fluent.codeplex.com/ to download a free ribbon for WPF. This ribbon has the style of the Office 2010 ribbon, and I've already used it in one of my apps. The download also has a lot of examples on how to implement the ribbon into a WPF application.
As far as switching from WinForms to WPF, yes it's a big learning curve, but at some point you should take the dive and start learning it. You'll be glad you did.

How to build UIs like skype

I want to know how can I build UIs like skype using standard .Net/C#. Is it possible at all?
Thanks
You can use Windows Presentation Foundation to build more stylish GUIs than Windows Forms. It's pretty difficult to move from Forms to WPF. You usually need a good design tool, like Expression Blend.
AFAIK skype was built using Qt4, it's rather easy to build custom gui widgets, check
C++ GUI Programming with Qt4, 2nd Edition and this tutorial.
P.S. check this to see how to build qt4 on windows using MSVC 2008.
It might be possible to build such an UI using Windows Forms, but only with a lot of custom control code or a really good component suite. But as Chris said, WPF should be the tool of your choice when you want to use .NET.
Qt4 is a really powerful C++ framework, also powering apps like Google Earth. The Qt SDK, inclduing everything you need to get started (Compiler, IDE, documentation), can be obtained here. It's licensed (among others) under the LGPL.
Windows Presentation Foundation will give you the most flexibility, but it can be hard to use. An alternative to this is Sliverlight - Version 3 is going to be capable of being used outside of the browser (similar to Adobe Air), and in some ways provides an easier development experience. You might want to consider using some third party controls to give you access to nice functionality that you wouldn't get out of box.
To my acknowledge Skype is build with Delphi an a set of third party tools, so it for sure can be done without WPF.
Take a look at the components from DevExpress or TMS.

C# controls in a MFC Application

I am responsible for the User Interface of an application written completely in Visual C++ using MFC and some third-part controls. I would like to use C# (WinForms or even better WPF) to improve the application look&feel.
I would like some advices about how to do it. Links, articles, examples...
Right now the user interface is isolated in a single project and I don't want to compile the whole module with CLR. So how do I have to manage that from the architectural point of view?
I have already looked at the Internet for the subject and read MSDN information. I would like more detailed information...is it convinient? pros/cons? have you used this approach successfully in a "big" application?
I don't want to compile the whole ui project with CLR...can I just have all the .NET code in a isolated project and call it from the ui project? what's the best way to do it?
Thanks in advance.
A good starting point is the Win32 and WPF interop page on MSDN.
I found this codeproject article gave a good introduction to the subject of mixing mfc / winforms code.
When faced with the same problem, I made an ActiveX control in C# and used it in my MFC app. The folks at MS took out support for building ActiveX controls with .NET, but it's still possible to do so with a plain Jane COM class which has a custom [ComRegisterFunction()] and [ComUnregisterFunction].
Although MS would like to tell us that the /clr flag will solve our problems, it measurably slowed down my large MFC app.

Categories

Resources