当前位置:网站首页>Selenium: detailed explanation of browser crawler use (I)
Selenium: detailed explanation of browser crawler use (I)
2022-07-26 07:28:00 【Happy little dog】
brief introduction :
Direct online search Selenium You'll know . In short Selenium Realize the automatic operation of the browser by simulating the operation of the browser . The difference between it and other reptiles is , Other crawlers simulate the browser to send requests , and Selenium It is the simulator that operates the browser .
Realization Selenium Things needed
1、 install Selenium
Use it directly pip Command to install , It is suggested to add domestic sources faster .
pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simpleYou may encounter many fucking problems during installation ( Baidu will solve it then )
such as :
selenium 4.3.0 requires urllib3[secure,socks]~=1.26, but you have urllib3 1.24.3 which is incompatible
requests 2.21.0 requires urllib3<1.25,>=1.21.1, but you have urllib3 1.26.10 which is incompatibleThen I installed the version
requests==2.28.1
urllib3==1.26.10
selenium==4.3.0
2、 Install browser driver
View your browser version , Find the driver of your browser version on the Internet and download .
Take Google browser for example :

Find the download address of the corresponding browser driver on the Internet :
Google : http://chromedriver.storage.googleapis.com/index.html
Be careful : There is no identical version to choose from , No, 64 Bits can be selected 32 Bit ,64 Bit compatible 32 position .


Unzip the driver into a folder , Then add the storage path to the Path variable .
Add the running startup software path of Google browser to the system environment variable Path variable .



It is recommended to restart the computer after modifying the environment variables , Otherwise, the setting may not take effect .
Install the test
from selenium import webdriver
import time
# Create browser driven objects ,Chrome() The representative is the driver of Google browser
driver = webdriver.Chrome()
# Visit website
driver.get('https://blog.csdn.net/m0_72501048?type=blog')
# Program pause 10 second
time.sleep(10)
# Output page title
print(driver.title)
# Close the current page
driver.close()
# Close the browser driver object
driver.quit()边栏推荐
- Apache DolphinScheduler 2.X保姆级源码解析,中国移动工程师揭秘服务调度启动全流程
- NFT digital collection development: Six differences between digital collections and NFT
- Deep learning model deployment
- :app:checkDebugAarMetadata 2 issues were found when checking AAR metadata: 2 issues were found when
- [C language] do you really know printf? (printf is typically error prone, and collection is strongly recommended)
- 配置Flask
- 「论文笔记」Next-item Recommendations in Short Sessions
- 时间序列分析预测实战之ARIMA模型
- 程序环境和预处理
- “尝鲜”元宇宙,周杰伦最佳拍档方文山将于7月25日官宣《华流元宇宙》
猜你喜欢

Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler

Apache dolphin scheduler & tidb joint meetup | focus on application development capabilities under the development of open source ecosystem

Speech at 2021 global machine learning conference

NFT digital collection system development: activating digital cultural heritage

Comparison and difference between dependence and Association

Machine learning related competition website

3.0.0 alpha 重磅发布!九大新功能、全新 UI 解锁调度系统新能力

Hcip--- MPLS detailed explanation and BGP route filtering

NFT digital collection system development: digital collections give new vitality to brands

To do list application vikunja
随机推荐
2019中兴捧月·模型压缩方案
Redis migrate tool migration error.
NFT数字藏品开发:数字藏品助力企业发展
Kdd2022 | uncover the mystery of Kwai short video recommendation re ranking, and recommend the new SOTA
深度学习模型部署
Anaconda 中安装 百度飞浆Paddle 深度学习框架 教程
Apache dolphin scheduler 2.x nanny level source code analysis, China Mobile engineers uncover the whole process of service scheduling and start
2021全球机器学习大会演讲稿
ShardingSphere数据分片
Learning Efficient Convolutional Networks Through Network Slimming
Modulenotfounderror: no module named 'pip' solution
Apache DolphinScheduler 2.X保姆级源码解析,中国移动工程师揭秘服务调度启动全流程
NFT digital collection development: Six differences between digital collections and NFT
[daily question 1] 919. Complete binary tree inserter
模型剪枝三:Learning Structured Sparsity in Deep Neural Networks
DCN (deep cross network) Trilogy
Taishan office lecture: word error about inconsistent values of page margins
【C语言】你真的了解printf吗?(printf典型易错,强烈建议收藏)
NLP自然语言处理-机器学习和自然语言处理介绍(三)
It's another summer of open source. 12000 project bonuses are waiting for you!