-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
98 lines (72 loc) · 2.72 KB
/
main.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=options)
driver.get("https://opensource-demo.orangehrmlive.com/")
driver.implicitly_wait(5)
def login():
driver.find_element(By.NAME, "username").send_keys("Admin")
time.sleep(2)
driver.find_element(By.NAME, "password").send_keys("admin123")
time.sleep(2)
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div/div[1]/div/div[2]/div[2]/form/div[3]/button').click()
act_title = driver.title
exp_title = "OrangeHRM"
if act_title == exp_title:
print("Login Test Passed")
else:
print("Login Test False")
login()
def forgot_pass():
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div/div[1]/div/div[2]/div[2]/form/div[4]/p').click()
time.sleep(5)
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/div/form/div[1]/div/div[2]/input').send_keys("Admin")
time.sleep(5)
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/div/form/div[2]/button[2]').click()
time.sleep(5)
driver.back()
time.sleep(5)
driver.back()
time.sleep(5)
print("Forgot Password Test Passed")
def Help():
driver.find_element(By.XPATH,'//*[@id="app"]/div[1]/div[1]/header/div[2]/nav/ul/div/button/i').click()
time.sleep(5)
h = driver.window_handles
par = h[0]
chi = h[1]
driver.switch_to.window(par)
time.sleep(5)
print("Help Test Passed")
def logout():
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/header/div[1]/div[2]/ul/li/ul/li[4]/a').click()
time.sleep(5)
print("logout Test Passed")
def about():
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/header/div[1]/div[2]/ul/li/ul/li[1]/a').click()
time.sleep(7)
driver.find_element(By.XPATH, '//*[@id="app"]/div[2]/div/div/div/button').click()
time.sleep(5)
print("About Test Passed")
def support():
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/header/div[1]/div[2]/ul/li/ul/li[2]/a').click()
time.sleep(5)
driver.back()
time.sleep(5)
print("Support Test Passed")
def account():
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/header/div[1]/div[2]/ul/li/span/p').click()
time.sleep(5)
about()
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/header/div[1]/div[2]/ul/li/span/p').click()
time.sleep(5)
support()
Help()
driver.find_element(By.XPATH, '//*[@id="app"]/div[1]/div[1]/header/div[1]/div[2]/ul/li/span/p').click()
time.sleep(5)
logout()
forgot_pass()
driver.quit()
account()