-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.py
More file actions
24 lines (18 loc) · 724 Bytes
/
search.py
File metadata and controls
24 lines (18 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from selenium import webdriver
import unittest
class TestSearchMethods(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.get('https://www.python.org/')
def test_search(self):
text = self.browser.find_element_by_id("id-search-field")
text.send_keys("python")
button_go = self.browser.find_element_by_id("submit")
button_go.click()
self.browser.find_element_by_xpath("//h3[text()='Results']")
def tearDown(self):
self.browser.close()
if __name__ == '__main__':
# unittest.main()
suite = unittest.TestLoader().loadTestsFromTestCase(TestSearchMethods)
unittest.TextTestRunner(verbosity=2).run(suite)