#!usr/bin/env python #-*- coding:utf-8 -*- #禁用IE的保护模式 from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import unittest,time class TestDemo(unittest.TestCase): def setUp(self): caps = DesiredCapabilities.INTERNETEXPLORER caps['ignoreProtectedModeSettings'] = True self.driver = webdriver.Ie(capabilities=caps) def test_cliseTheIEProtectedMode(self): self.driver.get('http://www.baidu.com') time.sleep(3) def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()