Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Tag Archives: keypress

How-to click a GWT 2.0 button with Selenium

I am testing a web application with selenium.
Some buttons of the web app are rendered with GWT 2.0, they cannot be clicked by “click” command.

There are other pages that describe and address this problem, such as:
Selenium Testing of GWT 2.0 and
Simulating clicks on GWT push buttons with Selenium RC
.

Nevertheless, when I was also pondering this problem, an old GUI technique came to my mind. You can “simulate” mouse click by pressing tab until the target widget get focus, then press Enter to activate that widget. Similarly, you can press Enter on the web element by

keyPress(elementLocator, \13)

Where 13 is ASCII for return