current position：Home>Python can actually realize the freedom of punch in?
Python can actually realize the freedom of punch in?
2022-02-02 05:25:23 【Pike pik】
We need to log in to the attendance system （ Web side , Non mobile terminal ） Check in , If you don't want to get up early every day and punch in , You can write a program to achieve this function .
Find the rules by getting up early and checking in for a long time , I just click every day , Sign in , All regular operations , Why not write a program to add Windows Realize automatic check-in , In this way, I don't have to spend time on the small matter of clocking in every day . Do as you say , I found that my daily clock in behavior can be summarized as " Login system --》 enter one user name 、 password --》 Click click --》 Exit the system ".
One day online browsing community , All of a sudden selenium Description of , Then check the relevant materials and find ,
selenium This thing is quite easy to use . In a word, it is selenium Will help us automatically enter the user name and password and click on something , It just coincides with my needs .
As for the selenium How to install this thing , I won't make wheels again . I installed webdriver It's Firefox , Because the attendance system is wonderful , Only Firefox login is allowed . As for the idea of procedure , I designed it like this , Put the user name and password in json In file , then Python Read out ,selenium Help me log in , Sign in , Exit the system, etc , After signing in, you will send me an email . therefore , You can also learn from this article Python How to read json file ,Python How to use e-mail and other knowledge , You can kill many birds with one stone .
Packages that need to be imported ,from selenium import webdriver From selenium Import webdriver
Random dwell time , Indicates random delay 6 Seconds to 10 Time between seconds
Open the login attendance system ,webdriver.Firefox() Means to open a Firefox window
Clear the user name box and password box , At the same time, from the set json Get username and password , Sign in ,clear The method is to clear the existing input data in the current window
And then you need to go through find_element_by_css_selector、find_element_by_xpath、find_element_by_id And other methods to click the corresponding button , In general, through css perhaps id perhaps name Generally, you can find the value of the button , If it doesn't work , You can find the of the button through the extension program on Firefox xpath, If other properties are not easy to determine , Just use find_element_by_xpath, This is basically omnipotent .
Set the account password information of the person who needs to sign in , At first, I specified it directly in the string array , Later, in order that the software can be widely used , Join in json The configuration file
from json Get user information from the configuration file of 、 password , Here you can see Python How to read json Of documents
userinfo.json The user name and password information are shown in the figure below , Save it in the current directory
Send email notification
main Method to perform scheduling
It can be executed manually ,python qiandao-4-0.py
You can also join Windows Among the scheduled tasks
Program or script fill in , Under designation Python Installation path for
Add parameter , Indicates the path where the check-in script is located
E:\1.4-Python Source data \ Auto check in script -python-（4.0 edition ）-2\qiandao-4-0.py
From , Indicates the directory in which the scheduled task is operated when it is started , Because of my json Configuration files are also in E:\1.4-Python Source data \ Auto check in script -python-（4.0 edition ）-2, So I also fill in
E:\1.4-Python Source data \ Auto check in script -python-（4.0 edition ）-2
This article realizes how to use python+ selenium Realize automatic check-in on the web page , And add to Windows How to operate in the scheduled task of . Except punch in , You can also use this program to do something else , Draw inferences from one instance , From now on, you don't have to order any more .
author[Pike pik],Please bring the original link to reprint, thank you.
The sidebar is recommended
- 1313. Unzip the coding list (Java / C / C + + / Python / go / trust)
- Python Office - Python edit word
- Collect it quickly so that you can use the 30 Python tips for taking off
- Strange Python strip
- Python crawler actual combat, pyecharts module, python realizes China Metro data visualization
- DOM breakpoint of Python crawler reverse
- Django admin custom field stores links in the database after uploading files to the cloud
- Who has powder? Just climb who! If he has too much powder, climb him! Python multi-threaded collection of 260000 + fan data
- Python Matplotlib drawing streamline diagram
- The game comprehensively "invades" life: Python releases the "cool run +" plan!
guess what you like
Python crawler notes: use proxy to prevent local IP from being blocked
Python batch PPT to picture, PDF to picture, word to picture script
Advanced face detection: use Dlib, opencv and python to detect face markers
"Python 3 web crawler development practice (Second Edition)" is finally here!!!!
Python and Bloom filters
Python - singleton pattern of software design pattern
Lazy listening network, audio novel category data collection, multi-threaded fast mining cases, 23 of 120 Python crawlers
Troubleshooting ideas and summary of Django connecting redis cluster
Python interface automation test framework (tools) -- interface test tool requests
Implementation of Morse cipher translator using Python program
- [Python] numpy notes
- 24 useful Python tips
- Pandas table beauty skills
- Python tiktok character video, CV2 module, Python implementation
- I used Python to climb my wechat friends. They are like this
- 20000 words take you into the python crawler requests library, the most complete in history!!
- Answer 2: why can you delete the table but not update the data with the same Python code
- [pandas learning notes 02] - advanced usage of data processing
- How to implement association rule algorithm? Python code and powerbi visualization are explained to you in detail (Part 2 - actual combat)
- Python adds list element append() method, extend() method and insert() method [details]
- python wsgi
- Introduction to Python gunicorn
- Python dictionary query key value pair methods and examples
- Opencv Python reads video, processes and saves it frame by frame
- Python learning process and bug
- Imitate the up master and realize a live broadcast room controlled by barrage with Python!
- Essence! Configuration skills of 12 pandas
- [Python automated operation and maintenance road] path inventory
- Daily automatic health punch in (Python + Tencent cloud server)
- [Python] variables, comments, basic data types
- Spring boot calls Python interface
- Using Python to make a key recorder
- Python combat case, pyGame module, python implementation routine confession artifact vs no routine confession artifact
- Python series tutorial 132 -- why use indentation syntax
- 10 minutes to learn how to play excel easily with Python
- Python develops a color dynamic two-dimensional code generator in one hour, and uses the virtual environment to package and release the EXE program.
- Elimination of grammar left recursion in Python
- Python testing - the patches in Python
- Python image processing, CV2 module, OpenCV to achieve target tracking
- How to send alarm notification to nail in Python?
- Introduction to pandas operation
- Mail sending, SMTP and exchange sending in Python 3
- Show your hand and use Python to analyze house prices
- The strongest Python visualization artifact, none of them
- 8 practical Python skills that are easy to use and don't have to suffer a loss for half a year
- Tips: teach you to generate 30 cool dynamic interactive charts with one click of pandas
- I use one line of Python code to dynamically load dependencies
- Blow up this pandas GUI artifact and automatically turn the code!
- Getting started exploring and analyzing data using Python
- Python image processing, CV2 module, OpenCV to achieve template matching