-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-selenium.py
41 lines (28 loc) · 1.02 KB
/
test-selenium.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
#!/usr/bin/python
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
un = "admin"
pwd = "admin"
# Start selenium with the configured binary.
browser = webdriver.Firefox(executable_path='/usr/bin/geckodriver', firefox_options=options)
browser.implicitly_wait(30)
browser.maximize_window()
# Access the ceph-dashboard url
browser.get('http://10.70.42.252:11001')
assert "Ceph" in browser.title
#browser.save_screenshot('test.png')
un_field = browser.find_element_by_name("username")
pw_field = browser.find_element_by_name("password")
un_field.send_keys(un)
pw_field.send_keys(pwd)
button = browser.find_element_by_name("loginForm")
button.submit()
print('Login Successful')
element = browser.find_element_by_class_name("info-group-title").text
assert "Status" in element
element = browser.find_element_by_class_name("card-title m-4").text
assert "Cluster statuse" in element
#element = browser.find_element_by_class_name("ng-star-inserted").text
#print(element)
browser.quit()