Jump to content

AutoIt runs in C# project within Visual Studio IDE but not when compiled

Recommended Posts

I have a C#-based Selenium integration test project that uses Visual Studio 2012 + NUnit + Selenium + AutoIt. When I run this project from within the IDE in interactive debug mode, everything works perfectly in the 3 browsers I'm testing: Chrome, FF, and IE10/IE11. I'm able to use AutoIt to invoke and use File/Open dialogs.

However, when I compile an executable and run my tests from a command line, I'm seeing a problem with AutoIt. My integration tests that need to upload various files are able to invoke the File Upload dialog under windows (for all browser) but then my code stalls when it tries to plug the path & filename into the File/Open dialog. Here's some sample code that shows where the problem occurs:

            autoIt.WinActivate(OPEN_DIALOG); // This works
            // MAGIC-NUMBER: '1148' is the id for this field in the Common Control Dialog library
            autoIt.ControlSetText(OPEN_DIALOG, """1148", value); // This does NOT work
            // "Open" is the name of the button in the Common Control Dialog library
            autoIt.ControlClick(OPEN_DIALOG, "Open""1"); // Code never makes it to here

I'm currently blocked by this and would appreciate any suggestions / workarounds.

Edited by ArmchairBronco
Link to post
Share on other sites

More Data: The fact that I'm able to invoke the dialog tells me that the AutoIt DLL is properly registered, or the invocation would fail.

When I try to set the value, my code doesn't crash - it just stalls out on that line, and eventually my test will timeout and the test run will fail.

Could this be a 32-bit versus 64-bit issue?

Link to post
Share on other sites

If you actually invoke the dialog, It will be waiting for user input and blocking anything else.

try to invoke the dialog from another thread, but beware like AutoIt, I don't think the dll is thread friendly.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...