python3.5+selenium打开chrome浏览器,去掉ignore-certificate-errors提示
2015-12-17 13:42
776 查看
class OpenChrome(unittest.TestCase):
def setUp(self):
#打开chrome浏览器,路径中双斜杠
self.chromedriver = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe"
os.environ["webdriver.chrome.driver"] = self.chromedriver
#去掉提示
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"])
self.driver= webdriver.Chrome(self.chromedriver,chrome_options=options)
#最大化
self.driver.maximize_window()
# 隐性等待
self.driver.implicitly_wait(30)
self.base_url = "http://www.baidu.com"
self.verificationErrors = []
self.accept_next_alert = True
def test_open_chrome(self):
driver = self.driver
driver.get(self.base_url)
try: self.assertEqual("百度一下,你就知道", driver.title)
except AssertionError as e: self.verificationErrors.append(str(e))
def setUp(self):
#打开chrome浏览器,路径中双斜杠
self.chromedriver = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe"
os.environ["webdriver.chrome.driver"] = self.chromedriver
#去掉提示
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"])
self.driver= webdriver.Chrome(self.chromedriver,chrome_options=options)
#最大化
self.driver.maximize_window()
# 隐性等待
self.driver.implicitly_wait(30)
self.base_url = "http://www.baidu.com"
self.verificationErrors = []
self.accept_next_alert = True
def test_open_chrome(self):
driver = self.driver
driver.get(self.base_url)
try: self.assertEqual("百度一下,你就知道", driver.title)
except AssertionError as e: self.verificationErrors.append(str(e))
相关文章推荐
- [Ubuntu]Python的Web开发环境之mod_wsgi
- python--标准库 时间与日期 (time, datetime包)
- Python:浅拷贝与深拷贝copy.deepcopy()
- Python脚本实现项目工程自动远程部署
- Python]新手写爬虫全过程
- Python脚本实现发送邮件功能
- python_类的设计模式
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装
- python科学计算库安装