
selenium
文章平均质量分 67
Arthur54271
人生苦短,我用Python
展开
-
Python3-爬虫~selenium\phantomjs报错处理selenium.common.exceptions.ElementNotVisibleException
意思是element是不可见的。所以无法获取到。这时候就遇到一个难题,怎么把element变成可见的呢?这时候,我们就用ActionChains来模拟效果ActionChains(driver).click(driver.find_element(By.ID, ‘g-hd-searchs‘)).perform() #使用perform()才能执行action 这个时候,你会惊奇地发现:下拉菜单成功...转载 2018-05-17 10:37:37 · 2217 阅读 · 1 评论 -
Python3~Scrapy+PhantomJS+Selenium动态爬虫
转自http://jiayi.space/post/scrapy-phantomjs-seleniumdong-tai-pa-chong#fb_new_comment很多网页具有动态加载的功能,简单的静态页面爬虫对它就无能为力了。这时候就需要PhantomJS+Selenium两大神器,再加上Scrapy爬虫框架,就可以拼凑成一个动态爬虫。PhantomJS简单点说PhantomJS就是一个没有界...转载 2018-05-31 16:26:57 · 1131 阅读 · 0 评论 -
Python3~selenium\phantomjs实现改变js改变页面控件的属性(边框粗细,颜色,线的类型)\下拉
#执行js语句from selenium import webdriverimport time,osdriver=webdriver.PhantomJS()driver.get('https://www.baidu.com/')time.sleep(3)root_dir='baidu'if not os.path.exists(root_dir): os.mkdir(ro...原创 2018-05-23 14:29:31 · 1485 阅读 · 0 评论 -
Python3-selenium\phantomjs\bs4爬取斗鱼页面
from selenium import webdriverimport timefrom bs4 import BeautifulSoupclass douyuSelenium(): #初始化,启动斗鱼浏览器 def setup(self): self.driver=webdriver.PhantomJS() #获取斗鱼房间信息 def ...原创 2018-05-19 12:59:23 · 301 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\爬取XX网页电影过程中向下滚动网页问题
from selenium import webdriverimport os,timedriver=webdriver.PhantomJS()driver.get('https://movie.douban.com/typerank?type_name=%E5%89%A7%E6%83%85&type=11&interval_id=100:90&action=')...原创 2018-05-18 15:28:34 · 496 阅读 · 1 评论 -
Python3-爬虫~selenium\phantomjs\豆瓣登录过程中处理验证码
#豆瓣登录from selenium import webdriverfrom selenium.webdriver.common.action_chains import ActionChainsimport os,timedriver=webdriver.PhantomJS()driver.get('https://www.douban.com/')#网络请求时间time.sle...原创 2018-05-18 12:57:14 · 592 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\豆瓣音乐例子
from selenium import webdriverimport os,timefrom lxml import etree#豆瓣音乐root_dir='douban'if not os.path.exists(root_dir): os.mkdir(root_dir)#访问driver=webdriver.PhantomJS()base_url='https:...原创 2018-05-18 10:39:27 · 282 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\豆瓣应用例子
import requests,sslimport os,timefrom selenium import webdriver,commonfrom lxml import etreeroot_dir='douban/img'if not os.path.exists(root_dir): os.mkdir(root_dir)driver=webdriver.PhantomJ...原创 2018-05-17 12:43:14 · 642 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\ActionChains百度例子
#安装:pip install selenium=2.48.0#显示:pip show selenium#卸载:pip uninstall selenium#模拟用户行为import os,timefrom selenium import webdriver,commonimport seleniumfrom selenium.webdriver.common.action_cha...原创 2018-05-17 11:03:39 · 435 阅读 · 0 评论 -
Scrapy配合Selenium和PhantomJS爬取动态网页
Python世界中Scrapy一直是爬虫的一个较为成熟的解决方案,目前javascript在网页中应用越来越广泛,越来越多的网站选择使用javascript动态的生成网页的内容,使得很多纯html的爬虫解决方案失效。针对这种动态网站的爬取,目前也有很多解决方案。其中Selenium+PhantomJS是较为简单和稳定的一种。Selenium是一个网页的自动化测试工具,其本身是用python编写的。...转载 2018-06-01 09:22:53 · 987 阅读 · 0 评论