zoukankan      html  css  js  c++  java
  • python webdriver启动IE浏览器

    from selenium import webdriver
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
    from selenium.webdriver.common.proxy import *
    iedriver='C:Program Files (x86)Internet ExplorerIEDriverServer.exe'
    driver = webdriver.Ie(iedriver)
    driver.get("http://c.highpin.cn")

     
    说明:
    下载IEDriverServer,放到Internet安装路径内
    赋值IEDriverServer的路径到iedriver变量,启动时通过webdriver.Ie(iedriver)启动
     
    遇到的问题:
    1.只启动了iedriver,但是没有打开IE浏览器
    解决方法:先启动fiddle,再去执行脚本,可以正常打开IE浏览器
    说明:因为公司内部网络的原因,有代理,通过启动时加代理的方法我没有加成功,所以不确定是否可以解决这个问题。fiddle启动时会更改浏览器的代理,具体机制大家可以自己了解一下。
     
    2.启动IE浏览器时报错: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.
     
    解决方法:打开IE浏览器,工具->internet选项->安全,将Internet,本地Intranet,可信站点,受限站点下的启用保护模式选项统一(都勾选或都不勾选)
  • 相关阅读:
    图解 SQL 各种连接查询之间的区别
    虚拟机Ubuntu无法上网问题解决过程
    SQL语言(二) java怎样连接操作数据库中的数据
    SQL语言(一)
    编写简单的用户登录界面
    Java
    java第一阶段测试
    Net Core linux docker 部署异常
    .Net Core Cap 异常
    记.Net 创建文件
  • 原文地址:https://www.cnblogs.com/meitian/p/4837912.html
Copyright © 2011-2022 走看看