File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,7 @@ class MyTestClass(BaseCase):
74
74
self .click(' a[rel="license"]' )
75
75
self .assert_text(' copy and reuse' , ' div center' )
76
76
self .open(' http://xkcd.com/1481/' )
77
- image_object = self .find_element(' #comic img' )
78
- caption = image_object.get_attribute(' title' )
77
+ caption = self .get_attribute(' #comic img' , ' title' )
79
78
self .assertTrue(' connections to the server' in caption)
80
79
self .click_link_text(' Blag' )
81
80
self .assert_text(' xkcd' , ' #site-title' )
Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ def test_basic(self):
9
9
self .click ('a[rel="license"]' ) # Click element on page
10
10
self .assert_text ('copy and reuse' , 'div center' ) # Assert element text
11
11
self .open ('http://xkcd.com/1481/' )
12
- image_object = self .find_element ('#comic img' ) # Returns the element
13
- caption = image_object .get_attribute ('title' ) # Get element attribute
12
+ caption = self .get_attribute ('#comic img' , 'title' ) # Get attribute
14
13
self .assertTrue ('connections to the server' in caption )
15
14
self .click_link_text ('Blag' ) # Click on link with the text
16
15
self .assert_text ('xkcd' , '#site-title' )
@@ -72,14 +71,14 @@ def test_basic(self):
72
71
# self.assert_text('The blag of the webcomic', 'header_text')
73
72
# ]
74
73
#
75
- # The following lines :
74
+ # The following line :
76
75
# [
77
- # image_object = self.find_element('#comic img')
78
- # caption = image_object.get_attribute('title')
76
+ # caption = self.get_attribute('#comic img', 'title')
79
77
# ]
80
78
# Can also be written as:
81
79
# [
82
- # caption = self.get_attribute('#comic img', 'title')
80
+ # image_object = self.find_element('#comic img')
81
+ # caption = image_object.get_attribute('title')
83
82
# ]
84
83
#
85
84
# And the following line:
Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ def test_basic(self):
9
9
self .click ('a[rel="license"]' )
10
10
self .assert_text ('copy and reuse' , 'div center' )
11
11
self .open ('http://xkcd.com/1481/' )
12
- image_object = self .find_element ('#comic img' )
13
- caption = image_object .get_attribute ('title' )
12
+ caption = self .get_attribute ('#comic img' , 'title' )
14
13
self .assertTrue ('connections to the server' in caption )
15
14
self .click_link_text ('Blag' )
16
15
self .assert_text ('xkcd' , '#site-title' )
You can’t perform that action at this time.
0 commit comments