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

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/

主站蜘蛛池模板: 马尔康县| 岱山县| 仁布县| 洛南县| 北流市| 南投县| 阿图什市| 平邑县| 遂川县| 周宁县| 嘉定区| 永昌县| 韶山市| 马龙县| 大石桥市| 双江| 四平市| 云南省| 英山县| 山东省| 内丘县| 邵东县| 昌吉市| 唐河县| 宾川县| 应用必备| 寻乌县| 崇阳县| 湘潭县| 威海市| 大冶市| 义乌市| 巴林左旗| 满洲里市| 贡觉县| 丰原市| 海安县| 武安市| 孝义市| 镇巴县| 荆门市|