Skip to content

Commit 0cad455

Browse files
committed
Update my_first_test.py
1 parent 9f345b1 commit 0cad455

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ class MyTestClass(BaseCase):
7474
self.click('a[rel="license"]')
7575
self.assert_text('copy and reuse', 'div center')
7676
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')
7978
self.assertTrue('connections to the server' in caption)
8079
self.click_link_text('Blag')
8180
self.assert_text('xkcd', '#site-title')

examples/my_first_test.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ def test_basic(self):
99
self.click('a[rel="license"]') # Click element on page
1010
self.assert_text('copy and reuse', 'div center') # Assert element text
1111
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
1413
self.assertTrue('connections to the server' in caption)
1514
self.click_link_text('Blag') # Click on link with the text
1615
self.assert_text('xkcd', '#site-title')
@@ -72,14 +71,14 @@ def test_basic(self):
7271
# self.assert_text('The blag of the webcomic', 'header_text')
7372
# ]
7473
#
75-
# The following lines:
74+
# The following line:
7675
# [
77-
# image_object = self.find_element('#comic img')
78-
# caption = image_object.get_attribute('title')
76+
# caption = self.get_attribute('#comic img', 'title')
7977
# ]
8078
# Can also be written as:
8179
# [
82-
# caption = self.get_attribute('#comic img', 'title')
80+
# image_object = self.find_element('#comic img')
81+
# caption = image_object.get_attribute('title')
8382
# ]
8483
#
8584
# And the following line:

integrations/node_js/my_first_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ def test_basic(self):
99
self.click('a[rel="license"]')
1010
self.assert_text('copy and reuse', 'div center')
1111
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')
1413
self.assertTrue('connections to the server' in caption)
1514
self.click_link_text('Blag')
1615
self.assert_text('xkcd', '#site-title')

0 commit comments

Comments
 (0)