I am trying to automate the following scenario with selenium RC:
there must be pause ( pause (1) ) or waitForElementPresent between 2 clicks here is working sample for phpUnit. Strange, but clickAndWait does'n work
$this->open("/");
$this->type("q", "software");
$this->click("btnG");
for ($second = 0; ; $second++) {
if ($second >= 60) $this->fail("timeout");
try {
if ($this->isElementPresent("//a[@class='l']")) break;
} catch (Exception $e) {}
sleep(1);
}
$this->click("//a[@class='l']");
Try this xpath (//a[@class="l"])[1]
Just a side note, Google has a ban on automated queries. I was using Google to test when I was new to testing, now I use our own server.
What you are looking for is this:
//a[contains(text(), 'software')]
This selects the first link with "software" in the link text.