当前位置:网站首页>Small project - self connected campus network
Small project - self connected campus network
2022-07-27 01:44:00 【Study happily】
Related links
- To write python Code to open and login web pages 、 Click on the web page 、 Input information and other operations
- Chrom Drive related
- slenium Of select/option
This place can't be used .onclick(), Need to submit form , So with .submit()
input The type is also submit - slenium Of submit
- slenium Document official website
The process
【 Campus network of China University of mining and Technology 】
1. see chrome edition
2. Download the corresponding driver
3. Write code
What if you have logged in , You need to exit directly , Use if else Will report a mistake , Use it directly try except better
import time
from selenium import webdriver
from selenium.webdriver.support.select import Select
# 1、 establish Chrome example .
option = webdriver.ChromeOptions()
#chrome And chromedriver The absolute path of
option.binary_location= r'D:\softsetup\Google\Chrome\Application\chrome.exe'
driver = webdriver.Chrome(r'D:\softsetup\Google\Chrome\Application\chromedriver.exe')
# 2、driver.get Method will be positioned at the given URL The web page of .
# driver.get("https://www.baidu.com/") # get Accept url Can be how the website , Take Baidu as an example
driver.get("http://10.2.5.251/")
#z look for input
try:
driver.find_element_by_xpath('//*[@id="edit_body"]/div[3]/div[2]/form/input[2]').send_keys('*******')
driver.find_element_by_xpath('//*[@id="edit_body"]/div[3]/div[2]/form/input[3]').send_keys('*******')
select = driver.find_element_by_xpath('//*[@id="edit_body"]/div[3]/div[2]/select')
Select(select).select_by_value('@cmcc')
driver.find_element_by_xpath('//*[@id="edit_body"]/div[3]/div[2]/form/input[1]').submit()
driver.quit()
except:
driver.quit()
Then package the file
pyinstaller Installation and use 
Meet this problem , Can't be in pycharm Medium pack
PyCharm Terminal Operation module display : Cannot be “***” Item identified as cmdlet、 function 、 The name of the script file or runnable program
The final will be exe Put the file into the startup folder
C:\Users\ray\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup( Be careful \ray Is the user name of my own user , You should change your user name when copying and pasting )
Boot restart test , very nice, No longer need to open the browser, enter the URL, and then enter the user name and password
边栏推荐
猜你喜欢

Big model training is difficult to go to the sky? Here comes the efficient and easy-to-use "Li Bai" model library

Shell(6)if判断

DNS

Domain name analysis and DNS configuration installation

Web services (07) - LNMP one click deployment

7、 Loop statement

System safety and Application

13、 Command gadget

Shell (9) function

SSH and NFS services
随机推荐
Shell (10) array and bubble sort
正则表达式之小工具系列
1100: finding the number of combinations (function topic)
Shell(8)循环
深度学习过程中笔记(待完善)
十一、echo
Domain name analysis and DNS configuration installation
1101: numbers in reverse order (function topic)
第一次使用c语言自己编写程序,有大佬可以稍微帮忙看看嘛
Shell(10)数组和冒泡排序
7、 Loop statement
SSH and NFS services
Vector容器的底层实现
Shell loop statement
ONEFLOW source code list: GDB compilation and debugging
FaceNet
系统安全及应用
11、 Echo
Traversing binary trees in non recursive pre -, middle -, and post order
Lamp+discuz Forum