Arrow keys weirdness on Mac SUT

I'm walking through applications to display all menus and submenus, and while I'm doing this, the arrow keys suddenly don't work to move right (to the next menu item). SUT is Mac / Leopard.

I captured 2 images: menuExpandTriangle (the expansion triangle for submenus) and menu_blue (a patch of the blue highlighted menu to get me back to the top of the menu).

When I run the script below, I can't move to the right to the next menu item (see "this fails" comment). When I run this by hand and do the exact same thing, it all works.

Any ideas??

TypeText controlKey & F2 # this gives us the Apple highlighted
TypeText rightArrow, rightArrow # Moves right to File menu
TypeText downArrow # expose sub-menu
repeat
put imageLocation("menu_blue") into returnToTopLoc
put everyImageLocation("menuExpandTriangle") into expandList
put imageLocation("menu_blue") into returnToTopLoc
repeat with each item in expandList
moveTo it
end repeat
moveTo returnToTopLoc # move up to top level menu
TypeText rightArrow # this fails
end repeat

Comments

  • I should note that

    1. Before doing this, I can walk across the top level menus just fine (File, Edit, etc...). It happens after I've expanded sub menus.
    2. I can't use Text images, because of localization, and I want a more general solution to showing many applications and languages, not just the ones I know about.
  • Ah, figured it out, although it does still work differently than manually, so could you guys please explain this?

    What's happening is that the menu makes an ever-so-brief move to the next menu (rightArrow), but then the mouse brings it back. This doesn't happen the same way manually. Try this:

    1. In the SUT, without a script and just VNC connected, click on a Top Menu item, then move to a submenu (denoted by >), then back to the top menu, then from the keyboard type right arrow. Works as expected.

    2. Do the exact same thing again, except instead of typing on the keyboard, type in the Ad Hoc Do Box: "TypeText rightArrow". You'll see the menu jump to the right, but then return to the mouse.

    I don't like this - Eggplant should mimic user interaction more closely in this instance.
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    Thanks for posting your script! With that, I was able to reproduce your problem and figure out what's going on. A while back, there was a bug in Mac OS X in which keystrokes and mouse clicks would sometimes not register with the system and be processed until after the mouse was moved again. This could cause Eggplant scripts to fail. We overcame the problem by introducing a tiny "wiggle" of the mouse after typing and clicks so that Eggplant would act more "human" and trigger the OS to proceed.

    The wiggle did the trick, and rarely causes any problems, but in your case it's wiggling the mouse after it types the rightArrow key (while the mouse is positioned over the "menu_blue"), which causes the Mac to reselect the previous menu.

    Fortunately, there's a way to turn off the wiggle. Just add this line at the beginning of your script and it should work the way you want:
    set the wiggleMouseAfterTyping to off
    

    By the way, we think generated Text Images are the perfect solution for localization testing. Just create a translation table to select the localized text you want to click on, and your script can work in multiple languages without the need to capture any images. So you may want to give it a try.
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    Ah, I see you noticed the effect of the wiggle while I was composing my reply! :-) Let us know if you have any more trouble with it.
  • Very good - you guys ALWAYS have a solution and I knew one must exist.

    Per translations: it's pseudo translation (to check that everything is localizable that should be).
Sign In or Register to comment.