day4总结(爬虫的相关知识)

'''
今日内容

'''

'''
'''
'''
一 Selenium请求库
    1.什么是selenium?
        selenium是一个自动测试工具,它可以帮我通过代码
        去实现驱动浏览器自动执行相应的操作
        所以我们也可以用它来做爬虫

    2.为什么要使用selenium?
        主要使用selenium的目的是为了跳过登陆验证。

    3.安装与使用
        -下载驱动器:
            http://npm.taobao.org/mirrors/chromedriver/2.38/

        -下载selenium请求库
            -修改下载源为清华源
                -D:\python36\Lib\site-packages\pip\models\index.py
                -PyPI = Index('https://pypi.tuna.tsinghua.edu.cn/simple')

            -pip3 install selenium 或settings中安装

            -安装谷歌浏览器


'''
from selenium import webdriver
import time

'''
驱动浏览器的两种方式
'''
# 第一种直接去script文件中查找驱动
driver = webdriver.Chrome()
time.sleep(5)
driver.close()

# 第二种直接填写驱动路径
webdriver.Chrome(r'C:\Users\Dell\Downloads\chromedriver.exe')

 

posted @ 2019-06-28 09:00  大码蜂  阅读(107)  评论(0编辑  收藏  举报