当前位置:网站首页>[crawler] avoid script detection when using selenium

[crawler] avoid script detection when using selenium

2022-07-07 12:46:00 Big watermelon and small chestnut

Problem phenomenon

 There is a slider in a script attempt to login , No matter how you drag it , It will report errors . Even if the script fills in the data , Dragging the slider by yourself will always report errors .

Problem solving

 This problem is mainly due to the application's detection of scripts . The basis of the test is 
window.navigator.webdriver
 The following figure is modified , Return before setting true.
 When requesting a page , The first options Set it up . The following code is only for chrome 88 Useful above version .

 Insert picture description here

Script

from selenium.webdriver.chrome.options import Options

option = Options()
option.add_argument('--disable-blink-features=AutomationControlled')

web = Chrome(options=option)
web.get("https://www.baidu.com")
原网站

版权声明
本文为[Big watermelon and small chestnut]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071032371826.html