当前位置:网站首页>selenium防爬和模拟手机浏览器
selenium防爬和模拟手机浏览器
2022-06-22 07:15:00 【reg183】
在浏览器中使用webdriver时控制台中window.navigator.webdriver
元素会显示True,正常情况下来说应该是关掉的,所以我们用js来屏蔽掉这个元素
# 去掉浏览器头部提示
opt = Options()
opt.add_experimental_option('excludeSwitches', ['enable-automation'])
# 模拟iphone X浏览器,用不到可忽略
opt.add_experimental_option('mobileEmulation', {
'deviceName': 'iPhone X'})
driver = webdriver.Chrome(options=opt)
driver.get('https://www.xxxx.com')
# 使用js屏蔽window.navigator.webdriver
js = '''Object.defineProperty(navigator, 'webdriver', { get: () => undefined })'''
driver.execute_script(js)
边栏推荐
- Notes on advanced combinatorics -- Conclusion
- Coursera self driving car Part4 motion planning finalproject principle and key code analysis
- Generate string mode
- Real MySQL interview questions (20) -- video data analysis practice
- Jupyter notebook file storage location
- CONDA installation method of deepmd kit and the solution of slow speed
- 2022年毕业生求职找工作青睐哪个行业?
- Cesium加载3D Tiles模型
- Use of sessionstorage and localstorage
- Speed planning generation of coursera self driving car Part4 motion planning
猜你喜欢

6. 安装ssh连接工具(用于我们连接实验室的服务器)

The journey of an operator in the framework of deep learning

Error: unable to find vcvarsall Solutions to bat errors

antd 框架:点击链接重开浏览器页面——基础积累

CNN模型合集 | Resnet变种-WideResnet解读

Process engine solves complex business problems

Protection of RT thread critical section

Canoe uses tricks to export data from logging file/trace to Matlab for analysis

On vector norm

Tikz learning notes (IV) further exploration of circle and complex geometry
随机推荐
Tikz learning notes (III) marking and intersection of graphics
[out of distribution detection] deep analog detection with outlier exposure ICLR '19
MySQL面试真题(十八)——经营分析实战
Convolutional neural network (notes, for personal use)
希腊字母 - 开发中常用的系统/服务名 - 收集
Custom implementation of bind method in JS
Antd framework: click the link to reopen the browser page - Basic accumulation
编程题:移除数组中的元素(JS实现)
MySQL面试真题(二十)——视频数据分析实战
RT-Thread临界段的保护
JS implementation of random generation of 16 bit key -- Basic accumulation
咖啡供应链是如何被趟平的?
Wechat applet camouflage page (change the page content regularly)
流程引擎解决复杂的业务问题
On vector norm
Several methods of array de duplication in JS
Tpflow v6.0.6 official release
JS中控制对象的访问
Introduction to 51 Single Chip Microcomputer -- timer and external interrupt
Introduction notes to quantum computing (continuously updated)