Selenium 入门到精通系列:六
Selenium 入门到精通系列
PS:Checkbox方法
例子
HTML:
<html>
<head>
<title>测试页面</title>
</head>
<body>
<form action="" method="get">您喜欢的水果?<br /><br />
<label><input name="Fruit" type="checkbox" value="" />苹果 </label>
<label><input name="Fruit" type="checkbox" value="" />桃子 </label>
<label><input name="Fruit" type="checkbox" value="" />香蕉 </label>
<label><input name="Fruit" type="checkbox" value="" />梨 </label>
</form>
</body>
</html>
代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-04-23 16:12:33
# @Author : BenLam
# @Link : https://www.cnblogs.com/BenLam/
from selenium import webdriver
driver=webdriver.Firefox()
driver.get('test.html')
#选中所有的tag name为input的元素
inputs=driver.find_elements_by_tag_name('input')
#for循环勾选
for i in inputs:
if i.get_attribute('type')=='checkbox':
i.click()
driver.quit()
Selenium 入门到精通系列:六的更多相关文章
- Selenium 入门到精通系列:五
Selenium 入门到精通系列 PS:显式等待.隐式等待.强制等待方法 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019 ...
- Selenium 入门到精通系列:四
Selenium 入门到精通系列 PS:鼠标右键.鼠标悬停.键盘操作方法 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019 ...
- Selenium 入门到精通系列:三
Selenium 入门到精通系列 PS:Driver_Element 常用方法 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2 ...
- Selenium 入门到精通系列:二
Selenium 入门到精通系列 PS:用户登录 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019-04-23 16:12 ...
- Selenium 入门到精通系列:一
Selenium 入门到精通系列 PS:控制浏览器窗口大小.前进.后退.刷新 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 20 ...
- Spring Boot从入门到精通(六)集成Redis实现缓存机制
Redis(Remote Dictionary Server ),即远程字典服务,是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言 ...
- ArcGIS10从入门到精通系列实验图文教程(附配套实验数据持续更新)
@ 目录 1. 专栏简介 2. 专栏地址 3. 专栏目录 1. 专栏简介 本教程<ArcGIS从入门到精通系列实验教程>内容包括:ArcGIS平台简介.ArcGIS应用基础.空间数据的采集 ...
- Provisioning Services 7.6 入门到精通系列之一:PVS前期规划
1. Provisioning Services 产品概述 Provisioning Services (简称PVS)采用了一种与传统映像解决方案截然不同的方法,从根本上改变了硬件与依托硬件而运行的 ...
- Jenkins pipeline 入门到精通系列文章
Jenkins2 入门到精通系列文章. Jenkins2 下载与启动jenkins2 插件安装jenkins2 hellopipelinejenkins2 pipeline介绍jenkins2 jav ...
随机推荐
- webservice和wcf和web.api简单介绍
转自:无废话的wcf等等 在.net平台下,有大量的技术让你创建一个HTTP服务,像Web Service,WCF,现在又出了Web API.在.net平台下,你有很多的选择来构建一个HTTP Ser ...
- C++实现的Buffer类
写C#的同志一定觉得Byte []比C++的 BYTE * 加 Length的方式好的多.一来,只需要一个对象就可以是表示一段字节流,另一方面,由于C#的特性,不需要象C++那样还要记得删除指针.由于 ...
- STS使用git下载项目代码
在自己的eclipse 上安装git 插件,一般都自带了现在. 4.选择Clone URI 5.下一步输入刚才的复制的路劲,填写自己的github 账户名密码即可 6.选择要克隆的分支 7.设置本地g ...
- 【转载】对C#DateTime的一些扩展,计算周内第一天,最后一天
/// <summary> /// DateTime的一些扩展 /// </summary> public class DateTime2 { /// <summary& ...
- Linq不分组求多列的和
我们需要写Linq查询语句,使用let来创建一个新的变量 Let 关键字 “let”关键字在查询语法中很有用.它会投影一个新的范围变量,允许重新使用表达式并使查询更具可读性. 例如: 这里需要写,两遍 ...
- ZooKeeper系列(1)--分布式系统的基石
分布式架构有以下几点普适性的共性需求: 1. 提供集群的集中化的配置管理功能,可以不重启就让新的配置参数生效,类似与配置中心 2. 简单可靠的集群节点动态发现机制,便于动态发现服务,动态扩展 ...
- Oracle查找lobsegment、lobindex对应的表
在查看表空间的使用情况的时候,发现有几个LOBSEGMENT.LOBINDEX类型的对象占用了大量的空间.于是想找出那些表占用了大量的空间,以便于清理. Oracle对BLOB类型的定义 ...
- chromium之histogram.h
histogram不知道是干啥的 // Histogram is an object that aggregates statistics, and can summarize them in // ...
- Mysql 之 MERGE 存储引擎
MERGE 存储引擎把一组 MyISAM 数据表当做一个逻辑单元来对待,让我们可以同时对他们进行查询.构成一个 MERGE 数据表结构的各成员 MyISAM 数据表必须具有完全一样的表结构.每一个成员 ...
- git获取步骤
$ git init $ git config --global user.name "[name]" $ git config --global user.email [emai ...