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()


  • 相关阅读:
    浅谈SQLite——查询处理及优化
    .NET 并行(多核)编程系列之七 共享数据问题和解决概述
    sql 存储过程学习一
    SQL中获得EXEC后面的sql语句或者存储过程的返回值的方法 【收藏】
    script刷新页面,刷新代码
    C#编程中关于数据缓存的经验总结
    SQL存储过程的概念,优点及语法
    SQLite数据库安装、试用及编程测试手记
    c# sqlite 数据库加密
    进销存管理系统的设计与实现
  • 原文地址:https://www.cnblogs.com/nichoc/p/5543654.html
Copyright © 2011-2022 走看看