File tree Expand file tree Collapse file tree 5 files changed +35
-5
lines changed Expand file tree Collapse file tree 5 files changed +35
-5
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Same as my_first_test.py, but without the asserts.
3
+ """
4
+
1
5
from seleniumbase import BaseCase
2
6
3
7
Original file line number Diff line number Diff line change
1
+ '''
2
+ Bing.com page objects as CSS selectors
3
+ '''
4
+
5
+ class Page (object ):
6
+ search_box = 'input.b_searchbox'
7
+ search_button = 'input[name="go"]'
8
+ search_results = '#b_results'
Original file line number Diff line number Diff line change
1
+ '''
2
+ Bing.com testing example
3
+ '''
4
+
5
+ from seleniumbase import BaseCase
6
+ from .bing_objects import Page
7
+
8
+
9
+ class BingTests (BaseCase ):
10
+
11
+ def test_bing (self ):
12
+ self .open ('https://www.bing.com/' )
13
+ self .update_text (Page .search_box , 'github' )
14
+ self .assert_element ('li[query="github"]' )
15
+ self .click (Page .search_button )
16
+ self .assert_text ('github.com' , Page .search_results )
17
+ self .click_link_text ('Images' )
18
+ self .assert_element ('img[alt="Image result for github"]' )
Original file line number Diff line number Diff line change 9
9
class GoogleTests (BaseCase ):
10
10
11
11
def test_google_dot_com (self ):
12
- self .open ('http ://www.google.com' )
12
+ self .open ('https ://www.google.com' )
13
13
self .assert_element (HomePage .search_button )
14
14
self .assert_element (HomePage .feeling_lucky_button )
15
- self .update_text (HomePage .search_box , " github\n " )
16
- self .assert_text (" github.com" , ResultsPage .search_results )
17
- self .click_link_text (" Images" )
15
+ self .update_text (HomePage .search_box , ' github\n ' )
16
+ self .assert_text (' github.com' , ResultsPage .search_results )
17
+ self .click_link_text (' Images' )
18
18
self .assert_element ('img[alt="Image result for github"]' )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def test_basic(self):
11
11
self .open ("http://xkcd.com/1481/" )
12
12
title = self .get_attribute ("#comic img" , "title" ) # Grab an attribute
13
13
self .assertTrue ("86,400 seconds per day" in title )
14
- self .click ('link=Blag' ) # Click on link with the text
14
+ self .click ('link=Blag' ) # Click link containing the text
15
15
self .assert_text ('The blag of the webcomic' , 'h2' )
16
16
self .update_text ('input#s' , 'Robots!\n ' ) # Fill in field with the text
17
17
self .assert_text ('Hooray robots!' , '#content' )
You can’t perform that action at this time.
0 commit comments