Created
August 26, 2014 19:28
-
-
Save charandas/9033998660c9e27fa83f to your computer and use it in GitHub Desktop.
fetchText returning the casper object through mocha-casperjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (typeof chai === 'undefined') { | |
| console.log('This example requires chai to be installed adjacent to mocha-casperjs') | |
| casper.exit(-1) | |
| } | |
| describe('Google searching', function() { | |
| before(function() { | |
| casper.start('http://www.google.fr/') | |
| }) | |
| it('should retrieve 10 or more results', function() { | |
| casper.then(function() { | |
| casper.getTitle().should.contain('Google') | |
| casper.exists('form[action="/search"]').should.be.true | |
| this.fill('form[action="/search"]', { | |
| q: 'casperjs' | |
| }, true) | |
| }) | |
| casper.waitForUrl(/q=casperjs/, function() { | |
| this.echo(this.fetchText('#addlang > a')) | |
| }) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment