废话就不说了,直接上代码。
(第三方库自行安装。)
import select
from threading import Thread
from ping3 import ping
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains
import time
import requests
import keyword
def isConnected():
try:
html = requests.get("https://www.baidu.com",timeout=2)
return 1
except:
return 0
def login():
driver = webdriver.Chrome()
driver.implicitly_wait(10)
wait = WebDriverWait(driver, 10, 0.5)
driver.get("http://172.21.255.105")
wait.until(EC.presence_of_element_located((By.XPATH,"/html/body/div/div/div[2]/div/a/img")))
driver.find_element(By.XPATH,'/html/body/div/div/div[3]