11

Can I use Selenium to do WPF UI automation testing?

3 Answers 3

9

Support for WPF automation exists in WPF itself. Check out AutomationPeer. This article might help. This article is more detailed. All this is good if you want to automate interaction with the UI itself (the usefulness of which is debatable).

Another course of action is to unit test the business logic without touching the UI - if the application uses MVVM then the loose coupling between View and ViewModel should make unit testing a breeze. I get the impression that you're more into automating the UI though.

Sign up to request clarification or add additional context in comments.

Comments

7

Yes, you can use Appium which is based on Selenium.

There is a pretty good introductory blog post by Scott Hanselman: WinAppDriver - Test any app with Appium's Selenium-like tests on Windows.

You'll need the WinAppDriver that "supports testing Universal Windows Platform (UWP) and Classic Windows (Win32) apps on Windows 10 PCs".

Comments

-1

Selenium can be used to automate only web applications. If your WPF is an windows application you can not automate it.

If you WPF application runs in a web browser using XBAP, still you will not be able to automate the application. So the answer is NO.

3 Comments

For anyone looking for a 'good' tool, Microsoft's free official WinAppDriver has been made to mimic Selenium, you spin up a WinAppDriver and find elements by ID etc.
There are lot of restrictions on using the Microsoft Windows App Driver in corporate environment as it requires Developer access.
"If your WPF is an windows application you can not automate it." --> learn.microsoft.com/en-us/archive/msdn-magazine/2009/march/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.