当前位置:网站首页>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 .

边栏推荐
- [Qualcomm][Network] qti服务分析
- 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
- PHP executes shell script
- Vs Code configures go locale and successfully installs go related plug-ins in vscode problem: Tools failed to install
- Li Kou - binary tree pruning
- The use of MySQL in nodejs
- Why does new public chain Aptos meet market expectations?
- Session based recommendations with recurrent neural networks
- Basics of data communication - basic knowledge of network
- 如何写一篇百万阅读量的文章
猜你喜欢

【有奖提问】向图灵奖得主、贝叶斯网络之父 Judea Pearl 提问啦

服务器内存故障预测居然可以这样做!

Solve NPM -v sudden failure and no response

Uni app learning summary

Leetcode 504. 七进制数

Solve proxyerror: CONDA cannot proceed due to an error in your proxy configuration

Due to fierce competition in the new market, China Mobile was forced to launch a restrictive ultra-low price 5g package

Interview shock 68: why does TCP need three handshakes?

The charm of SQL optimization! From 30248s to 0.001s

Use of tabbarcontroller
随机推荐
Tableviewcell highly adaptive
Spolicy request case
Applet record
在.NET 6.0中配置WebHostBuilder
Node memory overflow and V8 garbage collection mechanism
Tower of Hanoi II | tower of Hanoi 4 columns
Distributed network communication framework: how to publish local services into RPC services
SPARK中 DS V2 push down(下推)的一些说明
B站这个视频我是跪着看完的
Reproduce the snake game in C language (I) build pages and construct snakes
汉诺塔II|汉诺塔4柱
Apple dominates, Samsung revives, and domestic mobile phones fail in the high-end market
分布式网络通信框架:本地服务怎么发布成RPC服务
Study notes of the third week of sophomore year
Azkaban [basic knowledge 01] core concepts + features +web interface + Architecture +job type (you can get started with Azkaban workflow scheduling system in one article)
Data communication foundation - layer 2 switching principle
Sqoop【环境搭建 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
Introduction to latex, EPS picture bounding box
Installation and use of cocoapods
Study notes of the first week of sophomore year