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