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 入门到精通系列:六的更多相关文章

  1. Selenium 入门到精通系列:五

    Selenium 入门到精通系列 PS:显式等待.隐式等待.强制等待方法 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019 ...

  2. Selenium 入门到精通系列:四

    Selenium 入门到精通系列 PS:鼠标右键.鼠标悬停.键盘操作方法 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019 ...

  3. Selenium 入门到精通系列:三

    Selenium 入门到精通系列 PS:Driver_Element 常用方法 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2 ...

  4. Selenium 入门到精通系列:二

    Selenium 入门到精通系列 PS:用户登录 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019-04-23 16:12 ...

  5. Selenium 入门到精通系列:一

    Selenium 入门到精通系列 PS:控制浏览器窗口大小.前进.后退.刷新 例子 #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 20 ...

  6. Spring Boot从入门到精通(六)集成Redis实现缓存机制

    Redis(Remote Dictionary Server ),即远程字典服务,是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言 ...

  7. ArcGIS10从入门到精通系列实验图文教程(附配套实验数据持续更新)

    @ 目录 1. 专栏简介 2. 专栏地址 3. 专栏目录 1. 专栏简介 本教程<ArcGIS从入门到精通系列实验教程>内容包括:ArcGIS平台简介.ArcGIS应用基础.空间数据的采集 ...

  8. Provisioning Services 7.6 入门到精通系列之一:PVS前期规划

    1.  Provisioning Services 产品概述 Provisioning Services (简称PVS)采用了一种与传统映像解决方案截然不同的方法,从根本上改变了硬件与依托硬件而运行的 ...

  9. Jenkins pipeline 入门到精通系列文章

    Jenkins2 入门到精通系列文章. Jenkins2 下载与启动jenkins2 插件安装jenkins2 hellopipelinejenkins2 pipeline介绍jenkins2 jav ...

随机推荐

  1. 计算机网络概述4_性能指标之时延,时延带宽积,往返时间RTT,利用率

    发送时延(传输时延):从发送分组的第一个比特算起,到该分组的最后一个比特发送完毕所需的时间. 总结:

  2. Google Map中的瓦片

    一.墨卡托投影google map使用的是EPSG:900913标准墨卡托投影(等角圆术地图投影)y = R*ln(tan(pi/4 + a/2))x = R*b当y等于piR时,投影图正好为一个正方 ...

  3. python入门基础:文件的读写

    文件的读写操作运用广泛,无论是何种语言都会涉及到文件的输入输出. 下面简单的总结一下文件的读写: 1:open()函数 f = open('workfile', 'w') 函数 open()返回文件的 ...

  4. 在js中获取request域中的内容

    1.可以使用小脚本<%%>实现: var pro_id=<%request.getPro_id()%>; 2.使用隐藏域实现: <input type="hid ...

  5. php开发微信图灵机器人

    本着开源为原则,为这个世界更美好作出一份共享,我就给大家做个指路人,如果实用,记得给提供开源的朋友一些鼓励. 简单介绍一下实现思路,使用swoole扩展接管php运行,由于swoole只能在类UNIX ...

  6. (二、下) springBoot 、maven 、mysql、 mybatis、 通用Mapper、lombok 简单搭建例子 《附项目源码》

    接着上篇文章中 继续前进. 一.在maven 的pom.xm中添加组件依赖, mybatis通用Mapper,及分页插件 1.mybatis通用Mapper <!-- mybatis通用Mapp ...

  7. 10 OCP知识点讲解 之 什么是Buffer Cache?

    OCP知识点讲解 之 什么是Buffer Cache? 分类: Oracle 2012-06-22 17:36:54   一.Buffer cache作用: Buffer cache是Oracle建立 ...

  8. ABAP术语-qRFC-Monitor

    qRFC-Monitor 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/10/1098543.html Central monitoring ...

  9. diff命令--比较两个文件的命令

    可以使用 --brief 来比较两个文件是否相同,使用 -c参数来比较这两个文件的详细不同之处,这绝对是判断文件是否被篡改的有力神器,

  10. h5图片上传简易版(FileReader+FormData+ajax)

    一.选择图片(input的file类型) <input type="file" id="inputImg"> 1. input的file类型会渲染为 ...