-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathC_multi_assertion.py
More file actions
28 lines (21 loc) · 913 Bytes
/
C_multi_assertion.py
File metadata and controls
28 lines (21 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import unittest
from selenium import webdriver
class SearchTests (unittest.TestCase):
def setUp(self):
self.a = webdriver.Firefox()
self.a.get("http://magento-demo.lexiconn.com/")
self.a.maximize_window()
def test_search_product1(self):
self.a.find_element_by_xpath("//input[@id='search']").send_keys("Bed & Bath")
self.a.find_element_by_xpath("//input[@id='search']").submit()
lis = self.a.find_elements_by_xpath("//h2[@class='product-name']/a")
self.assertEqual(12, len(lis))
def test_search_product2(self):
self.a.find_element_by_xpath("//input[@id='search']").send_keys("Bags & Luggage")
self.a.find_element_by_xpath("//input[@id='search']").submit()
lis = self.a.find_elements_by_xpath("//h2[@class='product-name']/a")
self.assertEqual(12, len(lis))
def tearDown(self):
self.a.close()
if __name__ == '__main__':
unittest.main(verbosity=2)