mac os 10.11.5 
mac自带python2.7,自己下载了python3.5,pip list查看系统中的安装包,本人电脑中已经安装了pip和setuptools,若未安装,请先使用

sudo apt-get install python3-setuptools
  • 1
  • 1
sudo apt-get install python3-pip
  • 1
  • 1

若使用命令有问题,可自行到官网下载相应安装包,执行Python setup.py install 安装即可;

1、安装selenium

执行 python3 -m pip install selenium

2、安装chrome驱动

驱动下载地址:http://docs.seleniumhq.org/download/选择对应系统的浏览器驱动 

或者直接到 
https://sites.google.com/a/chromium.org/chromedriver/下载最新版mac chrome驱动(需翻墙); 


我下载了mac64.zip和linux64.zip,共享地址:

链接: https://pan.baidu.com/s/1nvdKv7F 密码: uc2i

使用uname -a查看自己的系统是64位还是32位;

3、配置chrome驱动

将解压后的chromedriver移动到/usr/local/bin目录下 
否则在运行脚本时,会提示 
chromedriver executable needs to be in PATH错误 

4、selenium第一个脚本

编写第一个selenium脚本程序:

#!/user/bin/env python
# -*-coding:utf-8-*-
# @time : 16/11/8 12:09
# @Author : Zhangxy
# @File : 001baiduSearch.py
# @Software : PyCharm from selenium import webdriver driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
driver.find_element_by_id('kw').send_keys('selenium')
driver.find_element_by_id('su').click()
#driver.quit()

最新文章

  1. svn co
  2. ASP.NET MVC读取XML并使用ViewData显示
  3. Middleware In ASP.NET Core
  4. java的nio之:java的nio系列教程之java的io和nio的区别
  5. php 判断字符串在另一个字符串中位置
  6. 【转】打包AAC码流到FLV文件
  7. jvm栈和堆详解
  8. 一个可以提高开发效率的Git命令-- Cherry-Pick
  9. c3p0数据库连接池+mysql数据库基本使用方法
  10. Mac Os系统设置
  11. WebVR认识
  12. 自学Zabbix2.6-zabbix升级
  13. 通过位运算求两个数的和(求解leetcode:371. Sum of Two Integers)
  14. C++中重载操作符[ ]
  15. display: flex; 布局
  16. 【leetcode】344. Reverse String
  17. Swift中的的注释
  18. SonarQube配置LDAP认证集成
  19. Fiddler Web Debugger简单调试头部参数
  20. JBoss Wildfly (1) —— 7.2.0.Final编译

热门文章

  1. VMware-Ubuntu入门(1)
  2. 光学字符识别OCR-2
  3. 流式处理框架storm浅析(上篇)
  4. mysql primary partition分区
  5. TensorFlow——零碎语法知识点
  6. [python xml 学习篇][0]
  7. Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 2)
  8. ICPC南京补题
  9. 九度oj 题目1083:特殊乘法 清华大学2010年机试题目
  10. cURL介绍