You are using thenClick improperly. Make sure the then.click is not contained within a casper.evaluate block and note there is not the js
on the end of casper. It should be implemented as:
casper.thenClick('a', function() {
this.echo("I clicked on first link found, the page is now loaded.");
});
If you want to just perform a regular click on selector you can do the following:
casper.then(function() {
// Click on 1st result link
this.click('h3.r a');
});
If you would like to use javascript, make sure you are within a casper.evaluate statement. You can use the following:
casper.then(function() {
casper.evaluate(function() {
var testV = document.getElementById("test");
testV.click();
});
});