当前位置:网站首页>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 .
边栏推荐
- Session based recommendations with recurrent neural networks
- Use of pclint in vs2013
- Write a script that can run in Bash / shell and PowerShell
- Solve NPM -v sudden failure and no response
- 数通基础-Telnet远程管理设备
- Map key not configured and uniapp routing configuration and jump are reported by the uniapp < map >< /map > component
- IEEE conference upload font problem
- 万字详解“用知识图谱驱动企业业绩增长”
- 时间序列异常检测
- What is the principle of reflection mechanism?
猜你喜欢
Interview shock 68: why does TCP need three handshakes?
Data communication foundation STP principle
30 minutes to thoroughly understand the synchronized lock upgrade process
spolicy请求案例
Learning about opencv (1)
Jpg to EPS
数通基础-TCPIP参考模型
[award-winning question] ask Judea pearl, the Turing prize winner and the father of Bayesian networks
Map key not configured and uniapp routing configuration and jump are reported by the uniapp < map >< /map > component
Uniapp error 7 < Map >: marker ID should be a number
随机推荐
2022年中科磐云——服务器内部信息获取 解析flag
Time series anomaly detection
JS continuous assignment operation
Rocky basic exercise -shell script 2
Nodejs service background execution (forever)
Data communication foundation STP principle
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
SQL Server 2008 R2 installation problems
C language course design Tetris (Part 1)
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 TCPIP reference model
Solve proxyerror: CONDA cannot proceed due to an error in your proxy configuration
PHP executes shell script
苹果独占鳌头,三星大举复兴,国产手机在高端市场颗粒无收
Formwork (III)
Principle analysis and source code interpretation of service discovery
I finished watching this video on my knees at station B
Set view dynamic picture
Data communication foundation telnet remote management equipment
Flutter Event 派发