Objective
Mac comes with a python2.7 environment, so it's very easy to install the selenium environment on a Mac, and you can enter 2 instructions to install it.
Software that needs to be installed:
1.pip
2.selenium2.53.6
3.firefox44.dmg
4.Pycharm
(Environment with SELENIUM2+FIREFOX46 and the following version compatible, selenium3+firefox47+geckodriver)
First, selenium installation
1.mac comes with Python2.7,python inside and comes with Easy_install tool, so install PIP with Easy_install installation on line.
Pip is a special tool for installing Python packages, which is handy after installing the other packages.
$ sudo easy_install pip
2.selenium is currently the latest version is 3.0, about selenium2 and selenium3 the difference is not much to say, here is the recommended selenium2.53.6 version, continue to enter the following instructions can be installed.
$ sudo pip install selenium==2.53.6
Second, Pip view version number
1. If you have previously installed selenium, to see what the next version number is, you can use PIP Show selenium to view it.
$ pip Show Selenium
2. If you want to view all the third-party packages currently installed in Python, you can use the PIP Show list to view
$ pip Show list
Third, uninstall Selenium
1. If you have already installed selenium3 and want to downgrade to SELENIUM2, you can uninstall selenium first
$ sudo pip uninstall selenium
2. Hint Proceed (y/n)?, enter Y on the line
3. After successful uninstall, follow the first step, install selenium with PIP
$ sudo pip install selenium==2.53.6
Iv. Checking the Selenium environment
1. After installation, be sure to check your environment has not installed, first download install Firefox44 version of the browser (QQ group file has dmg download: 232607095) 2. Go to Python environment
$ python
3. Then pour into the selenium package, launch the browser, open the Baidu page, can successfully explain the environment no problem
>>>from Selenium Import Webdriver
>>>driver=webdriver. Firefox ()
>>>driver.get ("https://www.baidu.com")
Five, Pycharm installation
1. Go to pycharm website to download a DMG package, address: https://www.jetbrains.com/pycharm/download/
2. Select the Professional Pro version on Mac, then install it after download
3. Open the software, fill in the license server address Http://xidea.online, and then click Activate to Break!
Let's start your Hello world! tour.
Selenium+python Building on Mac Environment