1、Chrome
ChromeOptions是一個方便控制Chrome啟動時屬性的類晴楔,主要提供以下功能:
設(shè)置Chrome二進制文件位置:binary_location
添加啟動參數(shù):add_argument
添加擴展應(yīng)用:add_extension、add_encode_extension
添加實驗性質(zhì)的設(shè)置參數(shù):add_experimental_option
設(shè)置調(diào)試器地址:debugger_address
例:
from selenium import webdriver
options=webdriver.ChromeOptions()
options.add_argument('lan-zh_CN,UTF-8')
driver=webdriver.Chrome(chrome_options=options) #設(shè)置打開的瀏覽器默認打開語言格式為中文UTF-8
2界酒、Firefox
FirefoxProfile是一個方便控制Firefox啟動時屬性的類
火狐瀏覽器的屬性配置項一般在about:config[地址欄輸入about:config]
例:
from selenium import webdriver
profile=webdriver.FirefoxProfile()
profile.set_preference('network.automatic','hauwei.com')
driver=webdriver.Firefox(firefox_profile=profile)
#set_preference(self,key,value) # set_preference的格式:key為關(guān)鍵項,value為該項設(shè)置的值
ChromeDriver與Chrome版本對應(yīng)參照表
ChromeDriver Version Chrome Version
81.0.4044.69 81
81.0.4044.20 81
80.0.3987.106 80
80.0.3987.16 80
79.0.3945.16 79
78.0.3904.70 78
78.0.3904.11 78
77.0.3865.40 77
77.0.3865.10 77
76.0.3809.126 76
76.0.3809.68 76
76.0.3809.25 76
76.0.3809.12 76
75.0.3770.90 75
75.0.3770.8 75
74.0.3729.6 74
73.0.3683.68 73
72.0.3626.69 72
2.46 71-73
2.46 71-73
2.45 70-72
2.44 69-71
2.43 69-71
2.42 68-70
2.41 67-69
2.40 66-68
2.39 66-68
2.38 65-67
2.37 64-66
2.36 63-65
2.35 62-64
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者