官术网_书友最值得收藏!

Getting ready

First we need to install Selenium.  We do this with our trusty pip:

~ $ pip install selenium
Collecting selenium
Downloading selenium-3.8.1-py2.py3-none-any.whl (942kB)
100% |████████████████████████████████| 952kB 236kB/s
Installing collected packages: selenium
Successfully installed selenium-3.8.1

This installs the Selenium Client Driver for Python (the language bindings). You can find more information on it at https://github.com/SeleniumHQ/selenium/blob/master/py/docs/source/index.rst if you want to in the future.

For this recipe we also need to have the driver for Firefox in the directory (it's named geckodriver).  This file is operating system specific.  I've included the file for Mac in the folder. To get other versions, visit https://github.com/mozilla/geckodriver/releases.

Still, when running this sample you may get the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'

If you do, put the geckodriver file somewhere on your systems PATH, or add the 01 folder to your path. Oh, and you will need to have Firefox installed.

Finally, it is required to have PhantomJS installed.  You can download and find installation instructions at: http://phantomjs.org/

主站蜘蛛池模板: 平远县| 青田县| 高碑店市| 綦江县| 安塞县| 镇坪县| 酒泉市| 喀喇| 嘉荫县| 天峻县| 眉山市| 盱眙县| 邢台市| 浪卡子县| 惠水县| 平山县| 改则县| 五寨县| 桦甸市| 乌鲁木齐县| 云和县| 安宁市| 阿荣旗| 台湾省| 武胜县| 井冈山市| 梨树县| 毕节市| 义马市| 高青县| 金坛市| 潼南县| 定西市| 巴里| 桐乡市| 齐河县| 全州县| 西乡县| 怀来县| 宁蒗| 谷城县|