Python爬虫之selenium各种注意报错
刚刚写完第一个selenuim+BeautifulSoup实战爬虫 爬淘宝。发现代码写完后不加for 翻页的时候没什么问题 解析 操作 都没问题 也就是说第一页 的内容 完好
pagebtn=wait .until(EC.presence_of_element_located((By.CSS_SELECTOR, "#mainsrp-pager > div > div > div > div.form > span.btn.J_Submit")))
soup=BeautifulSoup(browser.page_source,'lxml')
info=soup.find(attrs={'id':'mainsrp-itemlist'})
imglist=info.find_all(attrs={'class':'J_ItemPic img'})
pricelist=info.find_all('strong')
locationlist=info.find_all(attrs={'class':'location'})
shopnamelist=info.find_all(attrs={'class':'shopname J_MouseEneterLeave J_ShopInfo'})
for imgsrcname,price,location, shopname in zip(imglist,pricelist,locationlist, shopnamelist):
data={}
data={
'name':imgsrcname.attrs['alt'],
'imgsrc':imgsrcname.attrs['src'],
'prick':price.get_text(),
'location':location.get_text(),
'shopname':shopname.contents[3].get_text()
}
collection.insert(data) pagebtn.click()
运行完好 数据库也有数据
可是需要频繁点击翻页的时候


对于刚刚学习的人 一大串英文 显然看不懂 百度翻译 查
检查代码,
也加了等待啊 显示等待
为什么还是报错
说实话我不知道,,

在前面+了一个sleep(5)让他慢点操作 就可以了 完美翻页100
总结:
我觉得在使用selenuim的时候 尽可能的少操作网页(输入,点击),尽量模拟人的行为 机器运行太快 浏览器可能反应不过来。
Python爬虫之selenium各种注意报错的更多相关文章
- python脚本中selenium启动浏览器报错os.path.basename(self.path), self.start_error_message) selenium.common.excep
在python脚本中,使用selenium启动浏览器报错,原因是未安装浏览器驱动,报错内容如下: # -*- coding:utf-8 -*-from selenium import webdrive ...
- python爬虫,使用urllib2库报错
urllib2发生报错URLError: <urlopen error [Errno 10061]:首先检查网址是否正确其次如果报这种错误,是因为ie里设置了代理,取消即可, 步骤: 打开IE浏 ...
- python中用selenium调Firefox报错问题
python在用selenium调Firefox时报错: Traceback (most recent call last): File "G:\python_work\chapter11 ...
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- Selenium Grid 运行报错 Exception thrown in Navigator.Start first time ->Error forwarding the new session Empty pool of VM for setup Capabilities
Selenium Grid 运行报错 : Exception thrown in Navigator.Start first time ->Error forwarding the new se ...
- selenium执行js报错
selenium执行js报错 Traceback (most recent call last): dr.execute_script(js) File "C:\Python27\l ...
- [Python爬虫]使用Selenium操作浏览器订购火车票
这个专题主要说的是Python在爬虫方面的应用,包括爬取和处理部分 [Python爬虫]使用Python爬取动态网页-腾讯动漫(Selenium) [Python爬虫]使用Python爬取静态网页-斗 ...
- Python 爬虫利器 Selenium 介绍
Python 爬虫利器 Selenium 介绍 转 https://mp.weixin.qq.com/s/YJGjZkUejEos_yJ1ukp5kw 前面几节,我们学习了用 requests 构造页 ...
- Python爬虫之selenium的使用(八)
Python爬虫之selenium的使用 一.简介 二.安装 三.使用 一.简介 Selenium 是自动化测试工具.它支持各种浏览器,包括 Chrome,Safari,Firefox 等主流界面式浏 ...
随机推荐
- (1)wr703n刷openwrt智能控制--配置wifi
下载winscp和putty这两个软件:再刷到openwrt,通过winscp软件可以图形化修改配置文件“/etc/config/network”就可以上网了,再查找如何安装luci界面,就可以在pu ...
- Elastic Stack-Elasticsearch使用介绍(二)
一.前言 写博客,更要努力写博客! 二.Mapping介绍 Mapping类似于数据库中的表结构的定义:这里我们试想一下表结构定义需要那些: 1.字段和字段类型,在Elasticsearch中 ...
- Angular CLI 升级 6.0 之后遇到的问题
Angular CLI 1.7.4 在使用 ng build --prod 会构建失败,而 ng build 是正常的.比较好的解决办法是使用 ng build --prod --extract-li ...
- Python支付宝在线支付API
一.蚂蚁金服开发平台申请测试账号 a. 登陆蚂蚁金服开放平台https://open.alipay.com/platform/manageHome.htm,在“开发中心”—“研发服务”下拉处选择沙箱作 ...
- jexus独立版设置支持https
先用命令找到libssl.so find / -name libssl.so.* 执行完命令之后找到libssl.so.x.x.x如(libssl.so.1.0.0) 再到jexus/runtime/ ...
- Object.clone()方法与对象的深浅拷贝
转载:[https://www.cnblogs.com/nickhan/p/8569329.html] 引言 在某些场景中,我们需要获取到一个对象的拷贝用于某些处理.这时候就可以用到Java中的Obj ...
- Vue.js——vue-resource
vue-resource是Vue.js的一款插件,它可以通过XMLHttpRequest或JSONP发起请求并处理响应. vue-resource使用 引入 npm install vue-reso ...
- (最详细)小米Note 3的Usb调试模式在哪里打开的流程
就在我们使用安卓手机链接PC的时候,或者使用的有些应用软件比如我们单位营销部门就在使用的应用软件引号精灵,之前使用的老版本就需要开启USB开发者调试模式下使用,现就在新版本不需要了,如果手机没有开启U ...
- pixy&STM32使用记录(串口&SPI外设)
先踏踏实实的把stm32的外设串口,SPI搞清楚,不要眼高手低,看不起小事.用SPI通信将pixy的数据读出来,将数据用串口发到串口助手上,然后处理数据,利用STM32的定时器调节pwm,控制电机,先 ...
- gnocchi resource批量删除
openstack监控告警,采集数据,部署VMware-controller后,之前的celometer采集的大量数据需要删除 1.第一部获取未采集所有虚拟机的IP,并组成grep -v 多条件的格式 ...