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 · 2175 阅读 · 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 · 1094 阅读 · 0 评论 -
Python3~selenium\phantomjs实现改变js改变页面控件的属性(边框粗细,颜色,线的类型)\下拉
#执行js语句 from selenium import webdriver import time,os driver=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 · 1437 阅读 · 0 评论 -
Python3-selenium\phantomjs\bs4爬取斗鱼页面
from selenium import webdriver import time from bs4 import BeautifulSoup class douyuSelenium(): #初始化,启动斗鱼浏览器 def setup(self): self.driver=webdriver.PhantomJS() #获取斗鱼房间信息 def ...原创 2018-05-19 12:59:23 · 271 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\爬取XX网页电影过程中向下滚动网页问题
from selenium import webdriver import os,time driver=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 · 452 阅读 · 1 评论 -
Python3-爬虫~selenium\phantomjs\豆瓣登录过程中处理验证码
#豆瓣登录 from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import os,time driver=webdriver.PhantomJS() driver.get('https://www.douban.com/') #网络请求时间 time.sle...原创 2018-05-18 12:57:14 · 550 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\豆瓣音乐例子
from selenium import webdriver import os,time from 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 · 233 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\豆瓣应用例子
import requests,ssl import os,time from selenium import webdriver,common from lxml import etree root_dir='douban/img' if not os.path.exists(root_dir): os.mkdir(root_dir) driver=webdriver.PhantomJ...原创 2018-05-17 12:43:14 · 585 阅读 · 0 评论 -
Python3-爬虫~selenium\phantomjs\ActionChains百度例子
#安装:pip install selenium=2.48.0 #显示:pip show selenium #卸载:pip uninstall selenium #模拟用户行为 import os,time from selenium import webdriver,common import selenium from selenium.webdriver.common.action_cha...原创 2018-05-17 11:03:39 · 400 阅读 · 0 评论 -
Scrapy配合Selenium和PhantomJS爬取动态网页
Python世界中Scrapy一直是爬虫的一个较为成熟的解决方案,目前javascript在网页中应用越来越广泛,越来越多的网站选择使用javascript动态的生成网页的内容,使得很多纯html的爬虫解决方案失效。针对这种动态网站的爬取,目前也有很多解决方案。其中Selenium+PhantomJS是较为简单和稳定的一种。Selenium是一个网页的自动化测试工具,其本身是用python编写的。...转载 2018-06-01 09:22:53 · 943 阅读 · 0 评论