美文网首页分布式爬虫框架
python爬虫学习-day5-selenium

python爬虫学习-day5-selenium

作者: 光小月 | 来源:发表于2019-05-15 23:33 被阅读23次

目录

  1. python爬虫学习-day1
  2. python爬虫学习-day2正则表达式
  3. python爬虫学习-day3-BeautifulSoup
  4. python爬虫学习-day4-使用lxml+xpath提取内容
  5. python爬虫学习-day5-selenium
  6. python爬虫学习-day6-ip池
  7. python爬虫学习-day7-实战

任务:

1.  安装selenium并学习。

2.  使用selenium模拟登陆163邮箱。

3.  163邮箱直通点:[https://mail.163.com/](https://mail.163.com/) 。

1. 安装selenium并学习

学习系列:

实例:

import time
from selenium import webdriver

browser = webdriver.Chrome()
url = 'http://mail.163.com'
browser.get(url)
time.sleep(3)

# open chrome tab
# browser.maximize_window()

time.sleep(5)
#找到邮箱账号登录框对应的iframe,由于网页中iframe的id是动态的,所以不能用id寻找
browser.switch_to.frame(0)
email = browser.find_element_by_name('email')
email.clear()
email.send_keys('username@163.com')
password = browser.find_element_by_name('password')
password.clear()
password.send_keys('password')
login_em = browser.find_element_by_id('dologin')
login_em.click()
time.sleep(10)

结果:

1
2
3

PS: 若你觉得可以、还行、过得去、甚至不太差的话,可以“关注”一下,就此谢过!

相关文章

  • python爬虫学习-day5-selenium

    目录 python爬虫学习-day1 python爬虫学习-day2正则表达式 python爬虫学习-day3-B...

  • Python爬虫学习(十六)初窥Scrapy

    Python爬虫学习(一)概述Python爬虫学习(二)urllib基础使用Python爬虫学习(三)urllib...

  • 资料

    Python爬虫系列(一)初期学习爬虫的拾遗与总结(11.4更) Python爬虫学习系列教程 Python爬虫学习手册

  • Python爬虫学习系列教程

    转自: 静觅»Python爬虫学习系列教程 Python爬虫学习系列教程 Python版本:2.7 一、爬虫入门 ...

  • 爬虫入门

    为什么要学习爬虫? Python做爬虫优势 关于Python网络爬虫,我们需要学习的有: 什么是爬虫? 网络爬虫(...

  • Python爬虫学习之小结(一)

    到目前为止,Python爬虫学习已经写了八篇文章,分别是: Python爬虫学习(一)概述Python爬虫学习(二...

  • python爬虫学习-day7-实战

    目录 python爬虫学习-day1 python爬虫学习-day2正则表达式 python爬虫学习-day3-B...

  • Python 基础爬虫目录

    目录 python爬虫学习-day1 python爬虫学习-day2正则表达式 python爬虫学习-day3-B...

  • python爬虫学习-day6-ip池

    目录 python爬虫学习-day1 python爬虫学习-day2正则表达式 python爬虫学习-day3-B...

  • python爬虫学习-day3-BeautifulSoup

    目录 python爬虫学习-day1 python爬虫学习-day2正则表达式 python爬虫学习-day3-B...

网友评论

    本文标题:python爬虫学习-day5-selenium

    本文链接:https://www.haomeiwen.com/subject/bfpmaqtx.html