18.Selenium+Python案例 -- 豆瓣
一.具体代码实现:
from selenium import webdriver driver = webdriver.Firefox()
driver.get('https://www.douban.com/') driver.find_element_by_id('form_email').clear()
driver.find_element_by_id('form_email').send_keys('XXX')
driver.find_element_by_id('form_password').clear()
driver.find_element_by_id('form_password').send_keys('XXX')
driver.find_element_by_xpath('//*[@id="lzform"]/fieldset/div[3]/input').click() with open('C://1.html','wb') as file: #读取豆瓣源代码保存到C://1.html
file.write(driver.page_source.encode('UTF-8')) driver.quit()
18.Selenium+Python案例 -- 豆瓣的更多相关文章
- 11.Selenium+Python案例--百度
一.具体代码实现 from selenium import webdriver from selenium.webdriver.common.action_chains import ActionCh ...
- 12.Selenium+Python案例 -- 今日头条(获取科技栏目的所有新闻标题)
一:具体代码实现 # -*- coding: utf-8 -*-# @Time : 2018/7/26 16:33# @Author : Nancy# @Email : NancyWangDL@163 ...
- 案例学python——案例三:豆瓣电影信息入库
闲扯皮 昨晚给高中的妹妹微信讲题,函数题,小姑娘都十二点了还迷迷糊糊.今天凌晨三点多,被连续的警报声给惊醒了,以为上海拉了防空警报,难不成地震,空袭?难道是楼下那个车主车子被堵了,长按喇叭?开窗看看, ...
- selenium模拟登录豆瓣和qq空间
selenium模拟登录豆瓣和qq空间今天又重新学习了下selenium,模拟登录豆瓣,发现设置等待时间真的是很重要的一步,不然一直报错:selenium.common.exceptions.NoSu ...
- <译>Selenium Python Bindings 2 - Getting Started
Simple Usage如果你已经安装了Selenium Python,你可以通过Python这样使用: #coding=gbk ''' Created on 2014年5月6日 @author: u ...
- selenium+python自动化测试
F12: 右键 选择复制 path 在selenium+python自动化测试(一)–环境搭建中,运行了一个测试脚本,脚本内容如下: from selenium import webdriver ...
- python爬虫积累(一)--------selenium+python+PhantomJS的使用(转)
阅读目录 一.Selenium介绍 二.爬虫为什么要用selenium? 三.PhantomJS介绍 四.PhantomJS安装 五.操作实战 六.在此推荐虫师博客的学习资料 selenium + p ...
- Python爬虫个人记录(四)利用Python在豆瓣上写一篇日记
涉及关键词:requests库 requests.post方法 cookies登陆 version 1.5(附录):使用post方法登陆豆瓣,成功! 缺点:无法获得登陆成功后的cookie,要使用js ...
- selenium+python自动化79-文件下载(SendKeys)
前言 文件下载时候会弹出一个下载选项框,这个弹框是定位不到的,有些元素注定定位不到也没关系,就当没有鼠标,我们可以通过键盘的快捷键完成操作. SendKeys库是专业的处理键盘事件的,所以这里需要用S ...
随机推荐
- redis通过命令批量删除key
需求:想删除 notify_ 开头的所有key redis-cli KEYS "notify_*" | xargs redis-cli DEL 通过 notify_* 来匹配
- Spring容器创建过程
Spring容器的refresh() 创建刷新 1 prepareRefresh() 刷新前的预处理 1) initProPertySources() 初始化一些属性设置: 子类定义个性化的属性 ...
- LeetCode——Sum of Two Integers
LeetCode--Sum of Two Integers Question Calculate the sum of two integers a and b, but you are not al ...
- JavaScript字符串转换为变量名
1.将一个字符串转换为变量名 [javascript] view plain copy print? function string_to_name(string){ let _name = 'var ...
- LeetCode第[1]题(Java):Two Sum (俩数和为目标数的下标)——EASY
题目: Given an array of integers, return indices of the two numbers such that they add up to a specifi ...
- Java Redis Pipeline 使用示例
1. 参考的优秀文章 Request/Response protocols and RTT 2. 来源 原来,系统中一个树结构的数据来源是Redis,由于数据增多.业务复杂,查询速度并不快.究其原因, ...
- No mojo definitions
pom.xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</gro ...
- Educational Codeforces Round 23E
题意:刚开始有一个空集合,现在有三种操作1,加x到集合中,2,删去集合中的一个x,3,查询集合中的x^p<l的个数 套路题,(看到异或和集合操作条件反射01字典树),加和删操作不说了,主要是查询 ...
- ionic2——开发利器之Visual Studio Code 常用插件整理
1.VsCode官方插件地址: http://code.visualstudio.com/docs 2.使用方法,可以在官网中搜索需要的插件或者在VsCode的“”扩展“”中搜索需要的插件 添加方法使 ...
- Codeforces Round #394 (Div. 2) B. Dasha and friends
B. Dasha and friends time limit per test:2 seconds memory limit per test:256 megabytes input:standar ...