当前位置:网站首页>Resolved (selenium operation Firefox Firefox browser error) attributeerror: 'webdriver' object has no attribute 'execute_ cdp_ cmd’
Resolved (selenium operation Firefox Firefox browser error) attributeerror: 'webdriver' object has no attribute 'execute_ cdp_ cmd’
2022-07-23 22:59:00 【No envy】
resolved (selenium Operate Firefox Firefox Browsers use stealth.min.js File hiding browser fingerprint feature error )AttributeError: ‘WebDriver’ object has no attribute ‘execute_cdp_cmd’
List of articles
Error code
My code is as follows , Want to use stealth.min.js File hide browser fingerprint features , I used to use Chrome There is no problem with the browser :
from selenium import webdriver
# 1. Initialize the configuration object
options = webdriver.FirefoxOptions()
# 2. No interface mode
options.add_argument('--headless')
options.add_argument('--disable-gpu')
# 3. Add request header to disguise browser
options.add_argument(
'user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0')
# 4. Tell the browser to remove it webdriver trace
options.add_argument("--disable-blink-features=AutomationControlled")
# 5. Do not load pictures to improve access speed
options.add_argument('blink-settings=imagesEnabled=false')
options.add_argument('--disable-images')
driver = webdriver.Firefox(options=options)
# 6. An implicit wait 10 second
driver.implicitly_wait(10)
# 7. Hide browser fingerprint
with open('stealth.min.js') as f:
js = f.read()
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": js
})
driver.get('https://bot.sannysoft.com/')
driver.save_screenshot('1.png')
driver.quit()
Error message :
Traceback (most recent call last):
File "E:/Python Study /1.py", line 23, in <module>
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
AttributeError: 'WebDriver' object has no attribute 'execute_cdp_cmd'

Error report translation
Translation of error reporting content : Property error :“WebDriver” Object has no properties “execute\u cdp\u cmd”, And it can't be used without that method
Error reason
Error reason :cdp namely Chrome DevTools Protocal, Chrome Developer tools agreement , Only applicable to Chrome browser , Other browsers cannot be used , But I tried Edge You can also use a browser
resolvent
1. Remove the error code and do not hide the browser fingerprint
2. Switch to Chrome Google Chrome or Edge Browsers use stealth.min.js File hide browser fingerprint features
边栏推荐
- SOLIDWORK learning notes: Sketch geometric relationships and editing
- El select drop-down box multi selection remote search anti display
- Drools (1): introduction to drools
- torchvision.datasets.ImageFolder前的数据整理及使用方法
- (CVPR-2022)BiCnet
- Array - 59. Spiral matrix II
- Tiktok launches multilingual subtitles and translation tools
- The role of physical layer, link layer, network layer, transport layer and application layer of tcp/ip model of internet protocol stack
- H7-tool serial port offline burning operation instructions, support TTL serial port, RS232 and RS485 (2022-06-30)
- Crazy bull market, where to go in the second half? 2021-04-30
猜你喜欢

Drools (1): introduction to drools

STM32F4查看系统各部分频率

Rails搭配OSS最佳实践

Array - 11. Containers with the most water
The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)

Getting started database days2

DeFi項目的盈利邏輯 2021-04-26

浅析基于NVR技术的视频能力与未来发展趋势

Lixia action 2022 Yuanqi digital round table forum will be launched soon

Array - 59. Spiral matrix II
随机推荐
Microsoft SQL Server database language and function usage (XIII)
Tap series article 7 | easy to manage pipeline configuration
关于电脑端同步到手机端数据
Getting started database days2
作为开发,你不得不知道的三个性能测试工具|Jmeter、Apipost、JMH使用指南
[unity3d daily bug] unity3d solves "the type or namespace name" XXX "cannot be found (are you missing the using directive or assembly reference?)" Etc
FL Studio 20.9 update Chinese version host Daw digital audio workstation
Programming in the novel [serial 18] the moon bends in the yuan universe
H7-tool serial port offline burning operation instructions, support TTL serial port, RS232 and RS485 (2022-06-30)
[problem handling] merge made by the 'ort' strategy
ES6箭头函数的使用
Utilisation des fonctions fléchées es6
13. Roman to integer
The canfd/can interface offline burning operation instructions of h7-tool have been updated (2022-07-12)
Tap series article 6 | application model of tap
Analysis of video capability and future development trend based on NVR Technology
小说里的编程 【连载之十七】元宇宙里月亮弯弯
Lixia action | Yuanqi Digitalization: existing mode or open source innovation?
【音视频技术】视频质量评价 MSU VQMT & Netflix vmaf
Getting started database days3