Selenium下Chrome配置


地址:https://peter.sh/experiments/chromium-command-line-switches/

options.add_argument('--headless') # 無頭模式
options.add_argument('--disable-gpu') # 禁用GPU加速
options.add_argument('--start-maximized')#瀏覽器最大化
options.add_argument('--window-size=1280x1024') # 設置瀏覽器分辨率(窗口大小)
options.add_argument('log-level=3') #INFO = 0 WARNING = 1 LOG_ERROR = 2 LOG_FATAL = 3 default is 0
options.add_argument("disable-cache") #禁用緩存

options.add_experimental_option('excludeSwitches', ['enable-logging']) #禁止打印日志

options.add_experimental_option('excludeSwitches', ['enable-automation'])
options.add_experimental_option('useAutomationExtension',False) # 禁用瀏覽器正受到自動測試軟件的控制的提示

options.add_argument('--disable-infobars') # 禁用瀏覽器正受到自動測試軟件的控制的提示(已棄用)

options.add_argument('--user-agent=""') # 設置請求頭的User-Agent
options.add_argument('--incognito') # 隱身模式(無痕模式)
options.add_argument('--hide-scrollbars') # 隱藏滾動條, 應對一些特殊頁面
options.add_argument('--disable-javascript') # 禁用javascript
options.add_argument('--blink-settings=imagesEnabled=false') # 不加載圖片, 提升速度

options.add_argument('--ignore-certificate-errors') # 禁用擴展插件並實現窗口最大化
options.add_argument('–disable-software-rasterizer')
options.add_argument('--disable-extensions')

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM