Jump to content
Michael_1106

Click checkbox in Windows application

Recommended Posts

Michael_1106

I need to click a checkbox in a Windows application, and the location may move (see attached).  I was planning to use OCR (like Tesseract), or something similar.  Do you know of a better solution?  I believe the Windows application was written in C#.

I ran the "Window Info" dialog, and hovered the mouse over the check boxes, but the control is the same for all the check boxes. I tried the ImageSearch DLL mentioned in other threads, but found it problematic. Whatever solution I find has to work on users' computers, running different versions of Windows.

I appreciate any help you can provide.

report.PNG

Edited by Michael_1106

Share this post


Link to post
Share on other sites
Michael_1106

Thanks for the tip!  It looks like that is giving me useful information.  I'll see if I can get it working.

Share this post


Link to post
Share on other sites
Earthshine

If that does not work,

Coded UI projects can test any .NET or new Windows Apps. With Coded UI projects, you can use the test recorder, it generates very nice C# that you can maintain and modify, and executes all your tests against any .NET app. It will show you how to search the items in the list and teach you to code. watch it in the debugger to learn more if needed.

You would need Visual Studio 2015 or 2017 Enterprise to create Coded UI projects, 

I ran into this problem at work and decided that since all our stuff is .NET here now, I am going to just use the wonderful UI Automation framework that Microsoft has freely given us to take advantage of. There probably isn't anything you can't do with C# either regarding interacting with any/all windows apps. I like having less limitations.

I could not even get SimpleSpy to ever work. best of luck. I would rather trust Microsoft and work with their true UI Automation framework directly, not through something some dude wrote. lol.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Michael_1106

Earthshine,

Coded UI projects does look like a powerful solution.  I had never heard of it before.  Unfortunately, I don't have Visual Studio Enterprise.  I only have the free Express version.

I'll try to find a PC with a full version of Visual Studio, so i can try that.  In any case, it's good to know.  Thank you.

– Michael

Share this post


Link to post
Share on other sites
Earthshine

Michael_1106,

well, still good news. You can get the free VS 2017 and it has NuGet built in so you can include the Microsoft references that you need and stull use NUnit (get wtih NUGET) to so the same thing. You just won't have the recorder to capture your test and create the code for you.

I used to buy subscription to MSDN for this very reason. Work covers my subscription now.


do check out that stuff posted above, the AutoIt wrapper UDF for .NET CLR, it's not bad. I just decided it would be easier to start using VS 2017 and Coded UI

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Earthshine

Michael_1106,

oh, and you can try for FREE trial period VS 2017 Enterprise

https://www.visualstudio.com/downloads/

When you install it, look at the options!! You will need to probably include the MS Test stuff and the Coded UI stuff!! important note.

Create a new Coded UI Project, use the recorder, poke the record button and do something like open notepad and type text, then save the document. Then stop recording and hit the Generate Code button! Test recorded with great efficient code that YOU can maintain and modify at will!

Actually, if I were you I would do a Coded UI against the thing you want to automate and look at the generated code. this is amazing stuff.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Michael_1106

Earthshine,

Thank you again!  In that case, I'll definitely try it.

– Michael

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×