-
Notifications
You must be signed in to change notification settings - Fork 0
/
t1.py
36 lines (27 loc) · 1.1 KB
/
t1.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
from selenium import webdriver
import requests, csv
import time
url = 'http://192.168.66.219/pan/nodes'
def CatchOnline():
driver = webdriver.Chrome()
driver.get(url)
driver.find_element_by_xpath('//*[@id="passwd"]').click()
driver.find_element_by_xpath('//*[@id="passwd"]').send_keys('Lock4Safe')
driver.find_element_by_xpath('/html/body/div/div/div/div/div[2]/form/button').click()
time.sleep(5)
f = open('C:/Users/Administrator/Desktop/123.csv', mode='a+', encoding='utf-8')
csv_writer = csv.writer(f)
a = driver.find_elements_by_xpath('//div[@class="card-body"]/table//tr/td[1]')
b = driver.find_elements_by_xpath('//div[@class="card-body"]/table//tr/td[5]/span')
# b = driver.find_element_by_xpath('//div[@class="card-body"]/table//tr[2]/td[5]/span').get_attribute('class')
for i,j in zip(a,b):
title = i.text
list = j.get_attribute('class')
print(title +'----' +list)
csv_writer.writerow([title,list])
f.close()
def star():
while True:
CatchOnline()
time.sleep(1800)
star()