selenium + python小demo

一、安装环境

# Python安装不在赘述
# Selenium安装: pip install selenium
# 还需要一个浏览器驱动(下载完后解压加入系统环境变量):
# Firefox: (https://github.com/mozilla/geckodriver/releases)
# Chrome:  (https://sites.google.com/a/chromium.org/chromedriver/)

二、访问百度首页demo

from selenium import webdriver

browse = webdriver.Chrome(r'D:\dandan\test_selenium\test_1_demo\chromedriver.exe')  # Declaration path
browse.get('http://www.baidu.com')  # Load page
print(browse.title)  # print title

你可能感兴趣的:(Python:Selenium)