Skip to content

Commit 0161bf2

Browse files
author
John Doherty
committed
Cleaned up google search example and added tag
1 parent 957b120 commit 0161bf2

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

features/google-search.feature

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@search
12
Feature: Searching for vote cards app
23
As an internet user
34
In order to find out more about the itunes vote cards app

page-objects/google-search.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
module.exports = {
22

3+
url: 'http://www.google.co.uk',
4+
35
elements: {
4-
searchInput: by.name('q')
6+
searchInput: by.name('q'),
7+
searchResultLink: by.css('div.g > h3 > a')
58
},
69

710
preformSearch: function (keywords) {
811

9-
var input = driver.findElement(page.search.elements.searchInput);
10-
11-
input.sendKeys(keywords);
12-
input.sendKeys(selenium.Key.ENTER);
12+
var el = page.googleSearch.elements.searchInput;
13+
14+
return driver.findElement(el).sendKeys(keywords, selenium.Key.ENTER);
1315
}
1416
};

step-definitions/google-search-steps.js

-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
module.exports = function () {
22

3-
var self = this;
4-
5-
6-
73
this.When(/^I search Google for "([^"]*)"$/, function (searchQuery, done) {
84

95
driver.get('http://www.google.com');
@@ -13,9 +9,6 @@ module.exports = function () {
139
input.sendKeys(searchQuery);
1410
input.sendKeys(selenium.Key.ENTER);
1511

16-
// page object example
17-
//page.search.preformSearch(searchQuery);
18-
1912
done();
2013
});
2114

0 commit comments

Comments
 (0)