Mac OS 10.11.5
Mac comes with python2.7, I downloaded the Python3.5,pip list to view the installation package in the system, I have the PIP and Setuptools installed on my computer, if not installed, please first use
sudo apt-get install python3-setuptools
sudo apt-get install python3-pip
If the use of the command is a problem, you can download the appropriate installation package on the official website, execute the python setup.py install installation;
1, installation Selenium
Performpython3 -m pip install selenium
2. Install Chrome Driver
Driver: http://docs.seleniumhq.org/download/Select the corresponding system browser driver
or directly to
https://sites.google.com/a/chromium.org/chromedriver/Download the latest version of MAC Chrome driver (requires FQ);
I downloaded Mac64.zip and linux64.zip, shared address:
Link: Https://pan.baidu.com/s/1nvdKv7F Password: uc2i
Useuname -ato see if your system is 64-bit or 32-bit;
3. Configure Chrome Driver
Move the extracted chromedriver to the/usr/local/bin directory
Otherwise, when you run the script, you are prompted
Chromedriver executable needs to BES in path error
4. Selenium first Script
Write the first selenium script program:
#!/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()
Mac Os+selenium2+chrome Driver +python3