资源简介
使用python对淘宝数据进行爬取,浏览器需要设置为搜狐浏览器,若不是搜狐浏览器,则需要对浏览器对象进行更改。

代码片段和文件信息
# coding: utf-8
# 打开cmd命令行 输入pip install selenium 下载包
# 从selenium中引入webdriver
from selenium import webdriver
# 引入时间模块
import time
# 1.创建浏览器对象,并打开浏览器
driver = webdriver.Firefox()
# 2.在浏览器中访问网址
driver.get(‘http://www.baidu.com‘)
# 当前页的网页源代码
# print driver.page_source
# 根据id查找某个标签
# element = driver.find_element_by_id(‘kw‘)
# # 输入搜索关键词
# element.send_keys(u‘淘宝‘)
# 通过id找到百度一下按钮
news_link = driver.find_element_by_link_text(‘新闻‘)
# # 执行点击操作
news_link.click()
# 程序休眠3秒
time.sleep(3)
# 退出浏览器
driver.quit()
# element 不加s 找到的是一个标签
# driver.find_element_by_id() # 根据id查找
# driver.find_element_by_class_name() # 根据class查找
# driver.find_element_by_css_selector() # 根据css选择器查找
# driver.find_element_by_name() # 根据name查找
# driver.find_element_by_link_text() # 根据链接文本查找
# elements 查找多个符合条件的标签,并且返回一个列表
# rs = driver.find_elements_by_class_name(‘mnav‘)
# print rs
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-12 11:52 2018_1_12_am\
目录 0 2018-01-12 11:55 2018_1_12_am\.idea\
文件 516 2018-01-12 09:29 2018_1_12_am\.idea\2018_1_12_am.iml
文件 598 2018-01-12 09:28 2018_1_12_am\.idea\deployment.xm
目录 0 2018-01-12 09:28 2018_1_12_am\.idea\inspectionProfiles\
文件 270 2018-01-12 09:28 2018_1_12_am\.idea\inspectionProfiles\Project_Default.xm
文件 213 2018-01-12 09:29 2018_1_12_am\.idea\misc.xm
文件 276 2018-01-12 09:26 2018_1_12_am\.idea\modules.xm
文件 17309 2018-01-12 11:55 2018_1_12_am\.idea\workspace.xm
文件 1121 2018-01-12 10:29 2018_1_12_am\css_selector.html
文件 6527 2018-01-12 11:55 2018_1_12_am\geckodriver.log
文件 1207 2018-01-12 10:10 2018_1_12_am\sele_demo.py
文件 69007 2018-01-12 11:53 2018_1_12_am\shops.txt
文件 1505 2018-01-12 11:52 2018_1_12_am\taobao_spider.py
相关资源
- 基于Python爬虫爬取天气预报信息
- 一个简单的python爬虫
- Python爬虫数据分析可视化
- 北邮python爬虫学堂在线
- python爬虫爬取微博热搜
- python爬虫爬取旅游信息(附源码,c
- python爬虫爬取豆瓣电影信息
- Python爬虫实战入门教程
- Python爬虫相关书籍.zip
- 疫情数据爬虫并绘制柱状图.py
- python新浪微博爬虫,爬取微博和用户
- 一套最新价值1680元的python爬虫实战全
- 11-Python爬虫工程师-App抓取进阶
- 法律判决文书python爬虫、以及数据处
- Python爬虫、Flask框架与ECharts实现数据
- Python爬虫入门到实战 (二花) PDF版
- 学习python爬虫看一篇就足够了之爬取
- 基于Python智联招聘牌爬虫+本科毕业论
- Python爬虫开源项目代码
- 《Python爬虫-开发与项目实战》源码
- Python爬虫爬取智联招聘
- Python爬虫入门:如何爬取招聘网站并
- 基于selenium模拟天眼查登录并爬取企业
- python爬虫爬取杭州市幼儿园信息
- 《零基础:21天搞定Python分布爬虫》课
- python爬虫爬取豆瓣评分数据
- Python爬虫教学PPT
- Python爬虫开发与项目实战.mobi
- (一)python爬虫验证码识别去除干扰
- 全套从零开始学Python网络爬虫教学以
评论
共有 条评论