zoukankan      html  css  js  c++  java
  • mac 系统安装selenium注意事项

    mac最新系统:OS X EI Captian

    python: 本机自带的python2.7。 (本来想升级3.5,觉得太复杂,放弃了)

    pip: https://pypi.python.org/pypi/pip    下载版本pip 8.1.2.tar.gz (下载,解压,cd到目录,执行命令:sudo python setup.py install)

    selenium :sudo easy_install selenium     (联网安装,默认最新版,所以不用担心没有输入版本号)

    pycharm:版本2016.1   注册码如下

    http://idea.lanyus.com/    获取最新注册码 

    注意事项:

    1、使用python 的pip安装selenium报错

    chenchengdeMacBook-Pro:~ NichoC$ sudo pip install -U selenium

    Password:

    The directory '/Users/NichoC/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

    The directory '/Users/NichoC/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

    Requirement already up-to-date: selenium in /Library/Python/2.7/site-packages

    chenchengdeMacBook-Pro:~ NichoC$ 

    好像是权限不足,找了好多帖子没解决,放弃,后来换了命令sudo easy_install selenium 安装成功。

    2、本机没有安装firefox ,尝试其他浏览器的webdriver,都失败,最后下载安装firefox,不用配置path和路径直接完成

    推荐一个firefox 历史版本下载地址,selenium对最新版本的firefox 支持不好,建议下载历史版本:

    http://ftp.mozilla.org/pub/firefox/releases/        (选择版本号,选择平台MAC,选择语言zc-CN)

    3、测试selenium安装是否成功的用例(firefox弹出打开百度首页然后关闭)

    from selenium import webdriver
    browser = webdriver.Firefox()
    browser.get("http://www.baidu.com")
    browser.quit()


  • 相关阅读:
    面板评分太低会算两次
    没有使用大漩涡传送门没有杀死大法师瓦格斯
    win10创建本地用户
    延迟着色
    GPU 优化总结
    UE4 减少APK包的大小
    UE4 性能优化方法(工具篇)
    Unreal Engine 4的常见Tips
    虚幻引擎4设置Visual Studio
    模型导入的单位问题
  • 原文地址:https://www.cnblogs.com/nichoc/p/5543654.html
Copyright © 2011-2022 走看看