Problem with TypeCommand "a"


I have been using egg plant and have two scripts:
Script 1 opens a file in a dialog of our software and by opening the file it populates the filelds with data it contains.
Script 2 goes to every text filed populated by script 1 and type command a and then c in order to copy the text into remote clipboard.

The problem is when I execute script 1 and 2 individually it works fine, but when I include script 2 after script 1 in a common executer script, script 2 fails. In this case, script 2 is unable to click the text field and type command a and c. While on SUT if we observe, the mose moves to the text field, but does not click it.

Second issue is sometime and now its most of the time, while clicking any menu item, it click the main menu(a drop down menu) and opens it and before clicks an item in it, the problem is, it is unable to click the menu item and the menu closes. For example we have File >> Print menu… it click ‘File’, the menu opens, virtually it clicks ‘Print’ and menu closes, but factually the clic did not happen and print dialog box did not open.

Please suggest a solution to these.

Hi, Himani:

I don’t know why this would be affected by how the script is being run, but it sounds like a timing issue. I’d suggest that you slow down the mouse clicks. You can do this either in Eggplant > Preferences > Run Options or directly in your script using the following syntax:

setOption MouseClickDelay, .1 // for example

Setting it during the script affects only the script and lasts only as long as the script is running. Setting the value in the Preferences will affect all of your scripts until you reset it.

On the surface, this also sounds like a timing issue and I would start by seeing whether the change suggested above helps with this situation.

You didn’t mention what your system-under-test is; if these suggestions don’t help resolve the situation, please provide details of the SUT: the OS, processor speed, and anything else you think might be relevant.


The solution you suggested is not solving the problem. This is not a timing issue. Please find the hardware details of SUT below:
Machine Model: Power Mac G5
CPU Type: PowerPC G5 (2.2)
Number Of CPUs: 2
CPU Speed: 1.8 GHz
L2 Cache (per CPU): 512 KB
Memory: 512 MB
Bus Speed: 900 MHz
Boot ROM Version: 5.1.8f3
Serial Number: YM44166MQPQ

Sorry, Himani, I didn’t get an alert that you had posted to this thread again. With the problem clicking on the text field, I’m wondering now if you’re seeing a problem that we’ve recently run into with mouse clicks in Mac OS X. There seems to be an operating system bug where certain mouse clicks are not processed until the mouse is moved – the events are sent and the click is registered, but then the system just puts everything on hold until the mouse moves. You can even see this when working directly on a machine, especially if you use the trackpad on a laptop – sometimes clicking the mouse using the button beneath the trackpad seems to do nothing, but when you move the mouse, the event is suddenly processed.

We do have a code workaround which seems to cure most instances of this problem. The trick is to “wiggle” the mouse after each click. We do this by overriding the built-in Click command:

global RWIDefault

if RWIDefault is empty then
	set RWIDefault to getOptions("RemoteWorkInterval")
end if
setOption RemoteWorkInterval, 0

pass Message and continue

LogWarning <<"Wiggling" mouse>>
moveto mouseLocation() + (1,0)
setOptions RWIDefault
moveto mouseLocation() - (1,0)

This may look complicated, but all it is doing is a regular click, followed by moving the mouse one pixel to the right and then back again. I’m attaching a script to this message that you can use to enable this override. Simply put the script in either your main suite or a helper suite and then put the following line at the begining of your script(s):

start using ClickOverrides

I don’t think this should affect the problem you reported with clicking on a menu – are you still seeing that one?