#encoding=utf-8
import unittest
from selenium import webdriver
import time
from selenium.webdriver.chrome.options import Options
class TestDemo(unittest.TestCase):
def setUp(self):
# 創(chuàng)建Chrome瀏覽器的一個(gè)Options實(shí)例對(duì)象
chrome_options = Options()
# 向Options實(shí)例中添加禁用擴(kuò)展插件的設(shè)置參數(shù)項(xiàng)
chrome_options.add_argument("--disable-extensions")
# 添加屏蔽--ignore-certificate-errors提示信息的設(shè)置參數(shù)項(xiàng)
chrome_options.add_experimental_option(\
"excludeSwitches",["ignore-certificate-errors"])
# 添加瀏覽器最大化的設(shè)置參數(shù)項(xiàng),一啟動(dòng)就最大化
chrome_options.add_argument("--start-maximized")
# 啟動(dòng)帶有自定義設(shè)置的Chrome瀏覽器
self.driver = webdriver.Chrome(executable_path = "d:\\chromedriver",\
chrome_options = chrome_options)
def test_downloadFileByChrome(self):
self.driver.get("http://www.baidu.com")
time.sleep(3)
self.driver.find_element_by_id("kw").send_keys("光榮之路")
time.sleep(5)
def tearDwon(self):
self.driver.quit()
if __name__ == "__main__":
unittest.main()
網(wǎng)站題目:屏蔽Chrome的--ignore-certificate-errors提示及禁用擴(kuò)展插件并實(shí)現(xiàn)窗口
文章出自:http://sd-ha.com/article44/jgeohe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、網(wǎng)頁設(shè)計(jì)公司、Google、移動(dòng)網(wǎng)站建設(shè)、定制網(wǎng)站、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)