day04 pathon-Selenium基础

一、Selenium请求库
1、什么是Selenium?
Selenium是一个自动测试工具,它可以帮我通过代码去实现驱动器自动执行相应的操作。
所以我们也可以用它来做爬虫。
2、为什么要使用Selenium?
主要使用Selenium的目的是为了跳过登录验证
3、安装与使用
-下载驱动器:
http://npm.taobao.org/mirrors/chromedriver/2.38/
-下载Selenium请求库
-修改下载源为清华库
-
-PyPI = Index('https://pypi.tuna.tsinghua.edu.cn/simple')
-pip3 install selenium 或 setting中安装
'''
'''
驱动浏览区的两种方式
'''
第一种直接去Script文件夹中查找驱动
from Selenium import webdriver
import time
webdriver.Chrome()
time.sleep(5)
driver.close()

第二种填写驱动路径

webdriver.Chrome(r'C:\Users\Dell\Downloads\chromedriver.exe')

猜你喜欢

转载自www.cnblogs.com/wangziyu/p/11099468.html
今日推荐