Jump to content
Sign in to follow this  
CrazyTasty

Clicking a Button on a TabPage within an MDI child form

Recommended Posts

CrazyTasty

Please be patient for I'm a newbie with this new found yet wonderful tool.

For testing purposes, I have an MDI application with one Child form.

Witin the Child form, I have a TabControl with three TabPages.

On the first TabPage, I have a button embedded.

The button does nothing more than display a MessageBox.

All I'd like to accomplish is to automate the click of the embedded button.

I'm sure I have to focus/activate the correct "container" to achieve this but so far, no workie.

I've spent better part of a day trying a number of ways on my own (by using the help file) as well as example from this forum and other places, but to no avail.

Run("C:\Documents and Settings\<me>\Desktop\Code\Development\C#.NET\Test\MDI_Test\MDI_Test\bin\Debug\MDI_Test.exe")
WinWaitActive("Main MDI")
Send("!F")
Send("{ENTER}")
Send("{ENTER}")

ControlClick("Child", "", "[NAME:btnMessage]")

I've also attached a screen shot of the test GUI. (Forgive the asinine TabPage naming. It makes testing more enjoyable)

Thanks for any and all who can point me in the right direstion.

CT

post-64915-0-95104200-1305660409_thumb.p

Share this post


Link to post
Share on other sites
CrazyTasty

Please be patient for I'm a newbie with this new found yet wonderful tool.

For testing purposes, I have an MDI application with one Child form.

Witin the Child form, I have a TabControl with three TabPages.

On the first TabPage, I have a button embedded.

The button does nothing more than display a MessageBox.

All I'd like to accomplish is to automate the click of the embedded button.

I'm sure I have to focus/activate the correct "container" to achieve this but so far, no workie.

I've spent better part of a day trying a number of ways on my own (by using the help file) as well as example from this forum and other places, but to no avail.

Run("C:\Documents and Settings\<me>\Desktop\Code\Development\C#.NET\Test\MDI_Test\MDI_Test\bin\Debug\MDI_Test.exe")
WinWaitActive("Main MDI")
Send("!F")
Send("{ENTER}")
Send("{ENTER}")

ControlClick("Child", "", "[NAME:btnMessage]")

I've also attached a screen shot of the test GUI. (Forgive the asinine TabPage naming. It makes testing more enjoyable)

Thanks for any and all who can point me in the right direstion.

CT

If I put a sleep value after the loading of the form (database lookups) and before the code that clicks the Message button, I found that most of the bazzilion ways I tried before, will now work.

Great tool so far! I love it for automating mundane tasks, etc...

CT

Share this post


Link to post
Share on other sites
Tsukihime

It works because if you didn't put a delay there, the script will just continue to run without caring whether the other process has finished executing or not.

Alternatively, you can use runwait to force the script to pause execution until that MDI_Test.exe program finishes executing.

This should be a better solution since we don't actually know how long it will run.

Share this post


Link to post
Share on other sites
CrazyTasty

It works because if you didn't put a delay there, the script will just continue to run without caring whether the other process has finished executing or not.

Alternatively, you can use runwait to force the script to pause execution until that MDI_Test.exe program finishes executing.

This should be a better solution since we don't actually know how long it will run.

Yes, I figured that out to be a much better solution.

Thanks for your input....

CT

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.