Python+pycharm+selenium (MacOS)

Source: Internet
Author: User
Tags selenium python

MacOS:

1. Install Pycharm and create a new project. Project interpreter selected the path of my locally installed python2.7:/usr/bin/python

2. Open the Selenium Python language download page: https://pypi.org/project/selenium/, view the installation process above:

  • Open Terminal, RUN:PIP, if prompted not to know the PIP command, you need to install PIP first:
    • Open https://pip.pypa.io/en/stable/installing/
    • Run: Curl HTTPS://bootstrap. Pypa. Io/get-pip. Py -o get-pip. PY
    • Run: python get-pip. PY--user
    • Run:pip should know the PIP order this time.
  • In terminal, Run:pip install-u Selenium
  • Open Pycharm, open the project's Preferences page, click on Project Interpreter, click on the lower left corner of +--select Selenium, click Install Package, Selelium Import Successful .
  • Download Browser driver: https://www.seleniumhq.org/download/
  • Write a test code inside Pycharm to see if selenium works:
# !/usr/bin/python # -*-coding:utf-8-*-  from Import Webdriver  from Import  = Webdriver. Chrome ("/users/xx/pycharmprojects/pythonexercise/chromedriver")//  Notice that this changes to the address of your downloaded browser driver driver.get ("http://www.baidu.com") sleep ( driver.quit ()

Python+pycharm+selenium (MacOS)

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.