python+selenium 编写第一个自动化脚本 Ie版
来源:互联网 发布:ae cc 2014 mac 编辑:程序博客网 时间:2024/05/16 23:44
# coding=utf-8from selenium import webdriverdriver = webdriver.Ie()driver.get("http://www.baidu.com")driver.find_element_by_id("kw").send_keys("Selenium2")driver.find_element_by_id("su").click()driver.quit()
敲入如上代码,将代码保存为baidu.py(注意Ie大小写)
下载ie浏览器驱动,下载后将驱动保存在与python.exe同一个目录下,
记得将python路径和pip路径放到path中
右击用python idle打开,按F5运行,运行报错,报错如下:
Traceback (most recent call last):
File "C:\Users\lish\Desktop\baidu.py", line 4, in <module>
driver = webdriver.Ie()
File "C:\Users\lish\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 82, in __init__
desired_capabilities=capabilities)
File "C:\Users\lish\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 151, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Users\lish\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\lish\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "C:\Users\lish\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.
解决方法:把安全下红色框内的四个选项都勾上,然后保存,重启浏览器,再次回到idle,按F5运行即可
- python+selenium 编写第一个自动化脚本 Ie版
- 使用Python+selenium实现第一个自动化测试脚本
- 编写第一个自动化脚本
- 2、Selenium + Python 实现 UI 自动化测试-第一个自动化测试脚本
- 使用PyPharm编写第一个selenium脚本
- python-day0003-搭建基于python的selenium自动化测试---第一个简单的测试脚本
- python+robotframework --第一个UI自动化脚本
- 基于selenium的自动化测试脚本编写-python
- python+selenium 编写第一个程序 Firefox篇
- selenium入门第一个脚本(python篇)
- 怎样开始写第一个基于python的selenium脚本
- Selenium Webdriver 编写UI自动化测试脚本
- python基础之编写第一个python脚本
- 第一个自动化测试脚本
- Selenium学习笔记之005:第一个selenium+python+webdriver脚本
- 自动化脚本编写实例-python
- python 自动化测试脚本-->selenium应用
- 编写第一个python 脚本(重要文件创建备份)
- 业界丨涨薪20%!听听这位资深机器学习面试官的内心独白
- 1.Spring Boot创建SSM(IDEA+ORACLE)
- Java Web项目404错误
- Android Service stopself方法
- iis express IP地址访问
- python+selenium 编写第一个自动化脚本 Ie版
- 检查平衡二叉树
- 通过回调函数实现异步
- java 面向对象三大特性(封装,继承,多态)以及抽象、接口的介绍
- Mac上Python机器学习环境搭建
- SIP 协议之 注销(三)
- vmware 界面太小处理办法
- Activity进场动画后,关闭前一个页面
- opencv cvFastArctan整理