endyc Posted June 24, 2009 Share Posted June 24, 2009 Hello,I am developing a desktop application using visual basic .NET (visual studio 2005). I plan to use autoit to do functional test for the application (simulate user action and checking the results). When creating the script, I run into problem when trying to target controls (buttons, textbox, etc):first I tried using ID (ControlClick "formmain", "", "66736"), but whenever I rebuild, the ID changessecond I tried class and instance number (ControlClick "formmain", "", "[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:4]"), but then I have to update the script whenever I change the zorder of the control (bring to front and send to back) because it will change the instance numberIs there another way to reference a control? Link to comment Share on other sites More sharing options...
zfisherdrums Posted June 24, 2009 Share Posted June 24, 2009 Hello, I am developing a desktop application using visual basic .NET (visual studio 2005). I plan to use autoit to do functional test for the application (simulate user action and checking the results). When creating the script, I run into problem when trying to target controls (buttons, textbox, etc): first I tried using ID (ControlClick "formmain", "", "66736"), but whenever I rebuild, the ID changessecond I tried class and instance number (ControlClick "formmain", "", "[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:4]"), but then I have to update the script whenever I change the zorder of the control (bring to front and send to back) because it will change the instance numberIs there another way to reference a control? Hello, endyc; The beta version of AutoIt allows the targeting of WinForm controls. For example, if a WinForm contained a text field that was named "txtUsername", then one could reference that control like so: "[NAME:txtUsername]" If you do not wish to use the beta version, I wrote a set of functions that assist in obtaining the control handle. Just follow the link in my signature. HTH, Zach Fisher... Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
endyc Posted June 24, 2009 Author Share Posted June 24, 2009 The beta version of AutoIt allows the targeting of WinForm controls. For example, if a WinForm contained a text field that was named "txtUsername", then one could reference that control like so: "[NAME:txtUsername]" If you do not wish to use the beta version, I wrote a set of functions that assist in obtaining the control handle. Just follow the link in my signature.Thanks! I think I'll try the beta first. Actually I am using AutoItX inside NUnit tests. Do you happen to have a vb.net version of your function library? Link to comment Share on other sites More sharing options...
zfisherdrums Posted June 24, 2009 Share Posted June 24, 2009 (edited) Thanks! I think I'll try the beta first. Actually I am using AutoItX inside NUnit tests. Do you happen to have a vb.net version of your function library?The beta version of AutoItX contains the same functionality. If you're using an xUnit testing framework for functional test automation, you may want to also look at NUnitForms and/or UIAutomation.HTH,Zach Fisher... Edited June 24, 2009 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
endyc Posted June 25, 2009 Author Share Posted June 25, 2009 The beta version of AutoItX contains the same functionality. If you're using an xUnit testing framework for functional test automation, you may want to also look at NUnitForms and/or UIAutomation.NUnitForms looks abandoned. Version 2 is still in alpha and no updates since 2006.Still googling for UI Automation, can't seem to find any code samples. Link to comment Share on other sites More sharing options...
bo8ster Posted June 25, 2009 Share Posted June 25, 2009 Try Class and Text Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
zfisherdrums Posted June 27, 2009 Share Posted June 27, 2009 NUnitForms looks abandoned. Version 2 is still in alpha and no updates since 2006.Still googling for UI Automation, can't seem to find any code samples.Check these out when you have time:http://msdn.microsoft.com/en-us/library/ms747327.aspxhttp://msdn.microsoft.com/en-us/magazine/cc163465.aspxAlso, I failed to mention the White Project from Thoughtworks. This is a good one:http://www.codeplex.com/white Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now