Definite's Extractor

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

Tag Archives: selenium

[Selenium IDE] Skip 1.0.8, use the one in trunk.

Full story: http://code.google.com/p/selenium/issues/detail?id=955

Action: The bug is fixed in trunk, but not released yet, follow comment 6 to get the update from trunk.

Advertisements

Selenium key combination handling

I am working on the testing our new web-based translation management system, flies with selenium.

I used to stuck on emulating the key combination handling, such as Ctrl-Enter until recently. Here are steps to emulate a Ctrl-Enter.

controlKeyDown
keyDown theElement \13
keyPress theElement \13
keyUp theElement \13
controlKeyUp

The “theElement” is the web element that you want your hot keys to be press on. Yes, you need all keyDown, keyPress, and keyUp events.

Note that PageUp and PageDown might not be working. As their keycodes seems to collide with ! and ".

[Selenium] Converting XPath locator with CSS.

According to selenium’s web site, CSS locator is not only powerful, but also fast.
But despite of that, I was hesitated and kept using xpath, mainly because I hadn’t had idea about how to search by innertext.

Until yesterday, I find that the pseudo class :contains() suit my need. Even better, it supports regex, yay!

But the main push is that XPath is incapable of dealing with certain tags, such as <span>, <label>.

So CSS, here I come!

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