Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb2c1be

Browse files
author
Baiju Muthukadan
committed
bring back assertion
1 parent bc64eb9 commit eb2c1be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

source/getting-started.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ from Python like this.
2020
elem = driver.find_element_by_name("q")
2121
elem.send_keys("pycon")
2222
elem.send_keys(Keys.RETURN)
23+
assert "No results found." not in driver.page_source
2324
driver.close()
2425

2526
The above script can be saved into a file (eg:-
@@ -77,7 +78,10 @@ keyboard. Special keys can be send using `Keys` class imported from
7778
elem.send_keys("pycon")
7879
elem.send_keys(Keys.RETURN)
7980

80-
After submission of the page, you should get the result if there is any::
81+
After submission of the page, you should get the result if there is any.
82+
To ensure that some results are found, make an assertion::
83+
84+
assert "No results found." not in driver.page_source
8185

8286
Finally, the browser window is closed. You can also call `quit`
8387
method instead of `close`. The `quit` will exit entire browser where
@@ -114,6 +118,7 @@ for `python.org` search functionality::
114118
self.assertIn("Python", driver.title)
115119
elem = driver.find_element_by_name("q")
116120
elem.send_keys("pycon")
121+
assert "No results found." not in driver.page_source
117122
elem.send_keys(Keys.RETURN)
118123

119124
def tearDown(self):
@@ -208,7 +213,10 @@ keyboard. Special keys can be send using `Keys` class imported from
208213
elem.send_keys(Keys.RETURN)
209214

210215
After submission of the page, you should get result as per search if
211-
there is any.
216+
there is any. To ensure that some results are found, make an
217+
assertion::
218+
219+
assert "No results found." not in driver.page_source
212220

213221
The `tearDown` method will get called after every test method. This
214222
is a place to do all cleanup actions. In the current method, the

0 commit comments

Comments
 (0)