@@ -18,6 +18,7 @@ from Python like this.
18
18
driver.get("http://www.python.org")
19
19
assert "Python" in driver.title
20
20
elem = driver.find_element_by_name("q")
21
+ elem.clear()
21
22
elem.send_keys("pycon")
22
23
elem.send_keys(Keys.RETURN)
23
24
assert "No results found." not in driver.page_source
@@ -36,7 +37,7 @@ Example Explained
36
37
37
38
The `selenium.webdriver ` module provides all the WebDriver
38
39
implementations. Currently supported WebDriver implementations are
39
- Firefox, Chrome, Ie and Remote. The `Keys ` class provide keys in the
40
+ Firefox, Chrome, IE and Remote. The `Keys ` class provide keys in the
40
41
keyboard like RETURN, F1, ALT etc.
41
42
42
43
::
@@ -73,8 +74,11 @@ method. Detailed explanation of finding elements is available in the
73
74
74
75
Next we are sending keys, this is similar to entering keys using your
75
76
keyboard. Special keys can be send using `Keys ` class imported from
76
- `selenium.webdriver.common.keys `::
77
+ `selenium.webdriver.common.keys `. To be safe, we'll first clear any
78
+ prepopulated text in the input field (e.g. "Search") so it doesn't
79
+ affect our search results.
77
80
81
+ elem.clear()
78
82
elem.send_keys("pycon")
79
83
elem.send_keys(Keys.RETURN)
80
84
0 commit comments