-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathL_ddt.py
More file actions
25 lines (21 loc) · 772 Bytes
/
L_ddt.py
File metadata and controls
25 lines (21 loc) · 772 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
import unittest
from selenium import webdriver
from ddt import ddt, data, unpack
@ddt
class search (unittest.TestCase):
def setUp(self):
self.a = webdriver.Firefox()
self.a.implicitly_wait(30)
self.a.get("http://magento-demo.lexiconn.com/")
self.a.maximize_window()
@data (("Bed & Bath",12),("Bags & Luggage",12))
@unpack
def test_search(self,i,j):
self.a.find_element_by_xpath("//input[@id='search']").send_keys(i)
self.a.find_element_by_xpath("//input[@id='search']").submit()
lis1 = self.a.find_elements_by_xpath("//h2[@class='product-name']/a")
self.assertEqual(j, len(lis1))
def tearDown(self):
self.a.quit()
if __name__ == '__main__':
unittest.main(verbosity=2)