Commit 68a80b31 68a80b3114e8a199f8fe20d5a3f1283ba8571307 by Nicolas Perriault

fixed google search form selector in samples

1 parent 09669077
......@@ -7,13 +7,13 @@ casper = require('casper').create()
casper.start "http://google.fr/", ->
# search for 'casperjs' from google form
@fill "form[name=f]", q: "casperjs", true
@fill 'form[action="/search"]', q: "casperjs", true
casper.then ->
# aggregate results for the 'casperjs' search
links = @evaluate getLinks
# search for 'phantomjs' from google form
@fill "form[name=f]", q: "phantomjs", true
@fill 'form[action="/search"]', q: "phantomjs", true
casper.then ->
# concat results for the 'phantomjs' search
......
......@@ -10,14 +10,14 @@ function getLinks() {
casper.start('http://google.fr/', function(self) {
// search for 'casperjs' from google form
self.fill('form[name=f]', { q: 'casperjs' }, true);
self.fill('form[action="/search"]', { q: 'casperjs' }, true);
});
casper.then(function(self) {
// aggregate results for the 'casperjs' search
links = self.evaluate(getLinks);
// now search for 'phantomjs' by fillin the form again
self.fill('form[name=f]', { q: 'phantomjs' }, true);
self.fill('form[action="/search"]', { q: 'phantomjs' }, true);
});
casper.then(function(self) {
......
......@@ -30,7 +30,7 @@ casper.echo "Let the match begin between \"#{terms.join '", "'}\"!"
casper.start "http://google.fr/"
casper.each terms, (self, term) ->
@then -> @fill 'form[name=f]', { q: term }, true
@then -> @fill 'form[action="/search"]', { q: term }, true
@then ->
score = @fetchScore()
scores.push term: term, score: score
......
......@@ -2,8 +2,8 @@ casper = require('casper').create logLevel: "debug"
casper.start 'http://www.google.fr/', ->
@test.assertTitle 'Google', 'google homepage title is the one expected'
@test.assertExists 'form[name=f]', 'main form is found'
@fill 'form[name=f]', q: 'foo', true
@test.assertExists 'form[action="/search"]', 'main form is found'
@fill 'form[action="/search"]', q: 'foo', true
casper.then ->
@test.assertTitle 'foo - Recherche Google', 'google title is ok'
......
......@@ -4,8 +4,8 @@ var casper = require('casper').create({
casper.start('http://www.google.fr/', function(self) {
self.test.assertTitle('Google', 'google homepage title is the one expected');
self.test.assertExists('form[name=f]', 'main form is found');
self.fill('form[name=f]', {
self.test.assertExists('form[action="/search"]', 'main form is found');
self.fill('form[action="/search"]', {
q: 'foo'
}, true);
});
......