Mac Os+selenium2+chrome Driver +python3

Source: Internet
Author: User



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
    • 1
    • 1
sudo apt-get install python3-pip
    • 1
    • 1


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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.