n1k0/casperjs — pull request #8 by marchugon (2011-11-10 10:14:01+00:00)
Title: New thenClick step

I've added a "thenClick" function to solve the following problem.

Let's imagine that I test a website page like this :
- I open the website
- I click on a button with opens a div (content loaded with Ajax call)
- I want to click on a link in this div, which will open a new page

I didn't find a way to do it without the step I've added. My js script is now :

```javascript
casper.start('http://mywebsite/', function(self) {
self.click('a#popin');
self.waitForSelector('div.popin-content', function(self) {
self.test.assert(true, 'div.popin-content has appeared as expected');
resumeTests(self);
}, function (self) {
self.test.assert(false, 'div.popin-content has appeared as expected');
});
});
function resumeTests(self) {
self.thenClick('a#in_popin', true, function(self) {
self.test.assert(true, 'at last, I can continue my tests');
});
}
```