Skip to content

Commit 44a05bb

Browse files
committed
Add Google.com page object model example
1 parent f227963 commit 44a05bb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'''
2+
Google.com page objects
3+
'''
4+
5+
6+
class HomePage(object):
7+
google_logo = 'img[alt="Google"]'
8+
search_box = 'input[title="Search"]'
9+
search_button = 'input[value="Google Search"]'
10+
feeling_lucky_button = '''input[value="I'm Feeling Lucky"]'''
11+
12+
13+
class ResultsPage(object):
14+
search_results = 'div#center_col'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'''
2+
Google.com testing example
3+
'''
4+
5+
from seleniumbase import BaseCase
6+
from google_objects import HomePage, ResultsPage
7+
8+
9+
class GoogleTests(BaseCase):
10+
11+
def test_google_dot_com(self):
12+
self.open('http://www.google.com')
13+
self.assert_element_present(HomePage.google_logo)
14+
self.update_text(HomePage.search_box, "github\n")
15+
self.assert_text("github.com", ResultsPage.search_results)
16+
self.click_link_text("Images")
17+
self.assert_element('img[alt="Image result for github"]')

0 commit comments

Comments
 (0)