2012-10-02 34 views

Trả lời

71

Tìm thấy số chrome Options class in the Selenium source code.

Cách sử dụng để tạo ra một trường hợp lái xe Chrome:

from selenium import webdriver 
from selenium.webdriver.chrome.options import Options 
chrome_options = Options() 
chrome_options.add_argument("--disable-extensions") 
driver = webdriver.Chrome(chrome_options=chrome_options) 
+4

Câu trả lời này là một phao cứu sinh. Trong trường hợp nó hữu ích cho người khác, để kích hoạt tính năng ES6 Harmony, cuộc gọi là 'chrome_options.add_argument (" - js-flags = - harmony ")' – msridhar

5

Đây là cách tôi đã làm nó.

from selenium import webdriver 

chrome_options = webdriver.ChromeOptions() 
chrome_options.add_argument('--disable-extensions') 

chrome = webdriver.Chrome(chrome_options=chrome_options) 
1

Mã mà tắt các tiện ích chrome cho những người thân, những người sử dụng DesiredCapabilities để thiết lập cờ duyệt:

desired_capabilities['chromeOptions'] = { 
    "args": ["--disable-extensions"], 
    "extensions": [] 
} 
webdriver.Chrome(desired_capabilities=desired_capabilities) 
Các vấn đề liên quan