ubuntu14.04学习selenium之一:安装
环境:ubuntu14.04,python2.7 1,安装(好像是这样安装的) 查看版本 >>> import selenium
2,测试 from selenium import webdriver driver = webdriver.Chrome() # driver = webdriver.Firefox() driver.get('http://www.baidu.com') print driver.title driver.quit()运行时在driver = webdriver.Chrome()处报错: OSError: [Errno 20] Not a directory 这里使用webdriver.Chrome()或者webdriver.Firefox()都报一样的错
3,安装driver 找到这个方法: $ sudo apt-get install chromium-chromedriver 然而并没有效果,卸载之
查了半天,找到下载地址: chromedriver(Chrome浏览器): http://chromedriver.storage.googleapis.com/index.html geckodriver(Firefox浏览器) https://github.com/mozilla/geckodriver/releases
安装的方法:http://stackoverflow.com/questions/8255929/running-webdriver-chrome-with-selenium ''' chromium-browser -version sudo apt-get install chromium-browser /usr/bin directory sudo mv chromedriver /usr/bin /usr/bin directory and you would need to run something like chmod a+x chromedriver to mark it executable.finally you can execute the code. ''' 简单的说,就是下载解压后,放到/usr/bin,然后加上执行权限,命令如下: $ unzip chromedriver_linux64.zip $ sudo mv chromedriver /usr/bin/ $ sudo chmod +x chromedriver 另一个geckodriver也是一样
4,后记 再次执行测试代码成功,说明selenium基本安装成功了。 找了半天安装selenium的博客,但是没看到几个ubuntu下关于driver的具体安装的,所以我这里记录下。 (编辑:鄂州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 双系统ubuntu安装分区home,boot,root,swap,usr,tmp大小
- Ubuntu QT调试make_slc_s1a
- Linux Ubuntu系统上手动安装.NET Core SDK的方法
- ubuntu 16.10 Android模拟器打开失败的接近方法
- Ubuntu Desktop 16.04下安装Visual Studio Code
- ubuntu14安装tensorflow
- 无法使用桌面链接在Ubuntu 12中启动IntelliJ IDEA12
- 如何在Ubuntu 11.10 Oneiric中正确安装python-numpy
- 在Ubuntu / VMware上测量C中的短时间间隔
- ubuntu14.04安装gitbook和使用