Jump to content

ControlSend acting weird...


skaro13
 Share

Recommended Posts

Hi everyone, 

I'm getting some strange results using ControlSend & ControlSetText to automate some GUI tests. Sometimes, its as if the textbox was filled with the correct text but as soon as I click on it, the text disappear, a bit like place holder text... This happens randomly, as anyone ever had this kind of trouble?

Link to comment
Share on other sites

OK, I'm looking into my crystal ball to examine your code.....wait.....I see fog.....I see smoke.....crap. No code.

Yo Ernie! Bring me the thing I got from Wal-Mart yesterday....No, the glass eye thing. Yea, that's it!

. ....OK...Lets try my remote all seeing eye......it sees something....yep, it sees NOTHING!!!! Piece of junk....now what????

thinking.... :think:

thinking...  :think:

:idea: I know!

Lets do the old standby that ALWAYS works when someone post for help and wants us to guess -

 

How about you post your code and then we can figure out what the problem is. As you can see, crystal balls and all seeing eyes don't work.

Edited by Bert
Link to comment
Share on other sites

OK, I'm looking into my crystal ball to examine your code.....wait.....I see fog.....I see smoke.....crap. No code.

Lets try my remote all seeing eye......it sees something....yep, it sees NOTHING!!!!

 

Lets try something else - you post your code and then we can figure out what the problem is. As you can see, crystal balls and all seeing eyes don't work.

lol

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Moderators

Sometimes a program will set their WM_COMMAND etc parameters to catch edit/text changes, if they didn't do it themselves, they remove or replace it with the text that should have been there.  I know I've implemented this on a few of my own applications (to prevent easy automation tasks believe it or not).

But, I digress, without knowing the app, the code used, or really... anything more than what you've provided, we can only guess.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

There's really no elaborate code involved, just a simple ControlFocus and ControlSend...

ControlFocus("Location Description", "", "[CLASS:TEXTEDIT; INSTANCE:1]")
ControlSend("Location Description", "", "[CLASS:TEXTEDIT; INSTANCE:1]", $riskAddress)

 

In this precise case, these 2 lines are correctly executed and the value of $riskAddress is typed in the Textbox however as soon as this same textbox is clicked, the text typed is cleared (like a placeholder text). This is not the normal behaviour of this textbox. If I type text in it, focus on another control and click back on it, the text already entered is not cleared.

The application which I'm trying to automate is developed in VisualAge SmallTalk... Could there be any compatibility issues? I guess it should handle WM messages just like any Java, .Net... apps? Am I missing something?

I just wanted to know if anybody had ever encountered this kind of problem. We've used QTP for a long time and never had this kind of problem... 

 

Edited by skaro13
Link to comment
Share on other sites

  • Moderators

 

There's really no elaborate code involved, just a simple ControlFocus and ControlSend...

ControlFocus("Location Description", "", "[CLASS:TEXTEDIT; INSTANCE:1]")
ControlSend("Location Description", "", "[CLASS:TEXTEDIT; INSTANCE:1]", $riskAddress)

 

In this precise case, these 2 lines are correctly executed and the value of $riskAddress is typed in the Textbox however as soon as this same textbox is clicked, the text typed is cleared (like a placeholder text). This is not the normal behaviour of this textbox. If I type text in it, focus on another control and click back on it, the text already entered is not cleared.

The application which I'm trying to automate is developed in VisualAge SmallTalk... Could there be any compatibility issues? I guess it should handle WM messages just like any Java, .Net... apps? Am I missing something?

I just wanted to know if anybody had ever encountered this kind of problem. We've used QTP for a long time and never had this kind of problem... 

 

 

I'm sure QTP doesn't use a "send" method.

1.  Good job on focus, but let's see if we can do the change without it.

2.  Try ControlSetText instead of ControlSend.

3.  Maybe it wants you to do a mouseover/mousedown/mouseup method first... I had an app that once made me "ControlClick" it before I could set its text.  Again, it was managing it's application.

I have a feeling, the set text should work.

Also, I use the _GUICtrl[Edit/Listview/etc] udf functions as much as possible, so much more versatility.

Hope this helps, good luck.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...