-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomation.py
More file actions
43 lines (33 loc) · 1.15 KB
/
Copy pathautomation.py
File metadata and controls
43 lines (33 loc) · 1.15 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
34
35
36
37
38
39
40
41
42
43
from selenium import webdriver
import time
time.sleep(3)
# driver_path = 'C/Windows'
# web = webdriver.Chrome(executable_path=driver_path)
web = webdriver.Chrome()
web.get('http://192.168.0.253/webpages/login.html')
# wait to load the page
time.sleep(2)
# wait to load the page
PassForm = "admin"
last = web.find_element_by_xpath('/html/body/div[1]/div[2]/div[1]/div[1]/div/form[3]/div[2]/div/div/div[1]/span[2]/input[1]')
# enter admin password
last.send_keys(PassForm)
# enter admin password
# click Login button
Submit = web.find_element_by_xpath('/html/body/div[1]/div[2]/div[1]/div[1]/div/form[3]/div[3]/div/div/div/div[1]/button')
Submit.click()
# click Login button
# wait to load page after logging in
time.sleep(8)
# wait to load page after logging in
# click Reboot button
Submit2 = web.find_element_by_xpath('/html/body/div[1]/div[2]/div/div[2]/a[4]/span[1]')
Submit2.click()
# click Reboot button
# wait for the popup to show
time.sleep(2)
# wait for the popup to show
# click Yes at the popup to reboot
Submit3 = web.find_element_by_xpath('/html/body/div[5]/div[2]/div[4]/div/div/div[2]/div/div[2]/button')
Submit3.click()
# click Yes at the popup to reboot