zoukankan      html  css  js  c++  java
  • windows下pip升级到8.1.1 及安装Selenium

    1.升级pip

    windows CMD

    D:Program FilesPython34Scripts>pip install --upgrade pip 升级失败,提示尝试替换自身失败
    改用

    D:Program FilesPython34Scripts>easy_install pip 升级到最新版本

    Python环境

    python -m pip install -U pip

    2.安装Selenium

    windows CMD

    D:Program FilesPython34Scripts>pip install selenium

    输出:

    Requirement already satisfied (use --upgrade to upgrade): selenium in d:program
    filespython34libsite-packages

    VS建立项目测试:

    # -*- coding: utf_8 -*-

    import os
    from selenium import webdriver

    iedriver = "C:Program FilesInternet ExplorerIEDriverServer.exe"
    os.environ["webdriver.ie.driver"] = iedriver

    driver = webdriver.Ie(iedriver)
    driver.get("http://www.baidu.com")
    print(driver.title)
    driver.quit()

    运行提示:

    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

    修改注册表 HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settingsones

    修改1、2、3、4文件中2500属性值 修改成相同属性值、如1-2文件中是3,3-4文件中是0,修改3、4中2500属性值为3,重新运行脚本即可打开浏览器
    参考http://www.cnblogs.com/cllovewxq/p/5420546.html

  • 相关阅读:
    UVA11039
    UVA10970大块巧克力
    UVA10970大块巧克力
    UVA10340子序列
    UVA10340子序列
    UVA10382喷水装置
    UVA10382喷水装置
    UVA10020(最小区间覆盖)
    洛谷 P2141 珠心算测验
    UVa 11292 勇者斗恶龙(The Dragon of Loowater)
  • 原文地址:https://www.cnblogs.com/dennysong/p/5432483.html
Copyright © 2011-2022 走看看