-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTC4Assertion.py
More file actions
33 lines (26 loc) · 1.16 KB
/
TC4Assertion.py
File metadata and controls
33 lines (26 loc) · 1.16 KB
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
27
28
29
30
31
32
33
import unittest
from selenium import webdriver
class Test(unittest.TestCase):
def testName(self):
driver = webdriver.Chrome(executable_path="C:\driver\chromedriver.exe")
driver.get("https://www.google.com/")
titleis= driver.title
#assertEqual
# self.assertEqual("Google",titleis,"webpages titles are not same")
# self.assertNotEqual("Google",titleis,"WebPages titles are same")
# self.assertTrue(titleis == "Google") #True used when more than 2 parameters
self.assertFalse(titleis == "Google123")
check= None
self.assertIsNone(check)
self.assertIsNotNone(driver) #returns true bcoz driver contains value
#assertIn verifies whther the first element is present in the second element
#used in verifying presence of value in a list, tuple, set and directory
list= {"python","selenium","java"}
self.assertIn("python",list) # true
self.assertNotIn("ruby",list) #true
self.assertGreater(100,10)
self.assertLess(10,100)
self.assertGreaterEqual(100,100)
self.assertLessEqual(100,100)
if __name__=="__main__":
unittest.main()