当前位置:网站首页>About automatic operation on Web pages
About automatic operation on Web pages
2022-07-26 10:13:00 【SingleDog_ seven】
This time, let's learn about the simple function of automatic operation of web pages .
It uses selenium function , At the same time, you also need to install the driver of the corresponding browser version .
from time import sleep
from selenium import webdriver
wd = webdriver.Edge('msedgedriver') # This is the driver I quoted
wd.implicitly_wait(5) # Time set , Make the page fully loaded
wd.get(' Website ')
zhanghao ='xxxxx' # Set up account and password
mima = 'xxxxx' The preparations are ready , Next, let's login :
ele = wd.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[2]/div/input')# Find the place to click or fill
ele.send_keys(zhanghao) # Enter account send: Input
ele1 = wd.find_element_by_xpath('//*[@id="app"]/div/div/div/div[2]/div[2]/div/input')
ele.send_keys(mima)
ele2 =wd.find_element_by_xpath('//*[@id="app"]/div/div/button')
ele2.click() #click Click button , Options
sleep(1)You need to find the page by yourself xpath
Copy directly from the developer environment

Then operate according to the requirements of the page ( Input 、 Click on ), But sometimes when filling in, there is another page in the page
wd.switch_to.frame(" Value of web page ")
wd.switch_to.default_content() # return Use the code above to jump , And return to the original page .
This is to enter the page , Then step by step . You can also add a few more lines of code , Let's just look at the results .
And he has some defects : For example, it cannot run automatically , You must manually click the run button .
Okay , This is the content of this study .

边栏推荐
- Rocky basic exercise -shell script 2
- Study notes at the end of summer vacation
- Mysql5.7.25 master-slave replication (one-way)
- [information system project manager] summary of essence of high-level series for the first time
- What is the principle of reflection mechanism?
- Sqoop [put it into practice 02] sqoop latest version full database import + data filtering + field type support description and example code (query parameter and field type forced conversion)
- C language course design Tetris (Part 1)
- How to write a million reading article
- Flask framework beginner-03-template
- Learning about opencv (1)
猜你喜欢

Node memory overflow and V8 garbage collection mechanism

Vs Code configures go locale and successfully installs go related plug-ins in vscode problem: Tools failed to install

Uni app learning summary

protobuf的基本用法

论文笔记(SESSION-BASED RECOMMENDATIONS WITHRECURRENT NEURAL NETWORKS)

Leetcode 504. Hex number

Applet record

新增市场竞争激烈,中国移动被迫推出限制性超低价5G套餐
![[datawhale] [machine learning] Diabetes genetic risk detection challenge](/img/98/7981af7948feb73168e5200b3dfac9.png)
[datawhale] [machine learning] Diabetes genetic risk detection challenge

数通基础-二层交换原理
随机推荐
spolicy请求案例
Sqoop【付诸实践 02】Sqoop1最新版 全库导入 + 数据过滤 + 字段类型支持 说明及举例代码(query参数及字段类型强制转换)
[datawhale] [machine learning] Diabetes genetic risk detection challenge
Flutter event distribution
Sqoop [environment setup 01] CentOS Linux release 7.5 installation configuration sqoop-1.4.7 resolve warnings and verify (attach sqoop 1 + sqoop 2 Latest installation package +mysql driver package res
[fluorescent character effect]
Uniapp error 7 < Map >: marker ID should be a number
2021 windows penetration of "Cyberspace Security" B module of Shandong secondary vocational group (analysis)
30分钟彻底弄懂 synchronized 锁升级过程
In the same CONDA environment, install pytroch first and then tensorflow
Spolicy request case
Basic usage of protobuf
Docker configuring MySQL Cluster
AirTest
解释一下自动装箱和自动拆箱?
Data communication foundation STP principle
Basics of data communication - basic knowledge of network
Learning notes: what are the common array APIs that change the original array or do not change the original array?
Li Kou - binary tree pruning
Interview shock 68: why does TCP need three handshakes?