python-selenium-定位一组对象
16lz
2021-01-22
定位一组对象一般用于以下场景:
- 批量操作对象,比如将页面上所有的checkbox都勾上
- 先获取一组对象,再在这组对象中过滤出需要具体定位的一些对象。比如定位出页面上所有的checkbox,然后选择最后一个
checkbox.html
1 <html> 2 <head> 3 <meta http-equiv="content-type" content="text/html;charset=utf-8" /> 4 <title>Checkbox</title> 5 <script type="text/javascript" async="" 6 src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 7 <link 8 href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined 9 .min.css" rel="stylesheet" /> 10 <script 11 src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></ 12 script> 13 </head> 14 <body> 15 <h3>checkbox</h3> 16 <div class="well"> 17 <form class="form-horizontal"> 18 <div class="control-group"> 19 <label class="control-label" for="c1">checkbox1</label> 20 <div class="controls"> 21 <input type="checkbox" id="c1" /> 22 </div> 23 </div> 24 <div class="control-group"> 25 26 <label class="control-label" for="c2">checkbox2</label> 27 <div class="controls"> 28 <input type="checkbox" id="c2" /> 29 </div> 30 </div> 31 <div class="control-group"> 32 <label class="control-label" for="c3">checkbox3</label> 33 <div class="controls"> 34 <input type="checkbox" id="c3" /> 35 </div> 36 </div> 37 <div class="control-group"> 38 <label class="control-label" for="r">radio</label> 39 <div class="controls"> 40 <input type="radio" id="r1" /> 41 </div> 42 </div> 43 <div class="control-group"> 44 <label class="control-label" for="r">radio</label> 45 <div class="controls"> 46 <input type="radio" id="r2" /> 47 </div> 48 </div> 49 </form> 50 </div> 51 </body> 52 </html>
更多相关文章
- AttributeError:'Flask'对象没有属性'login_manager' - Login_Ma
- django页面中的'模糊'翻译?
- 在save方法中创建两个对象
- 在管理页面中编辑M2M的两面
- 'str'对象不能解释为groupby上的整数
- Python 面相对象 —— 类的三大成员
- Python_面向对象_单例模式
- 即使我返回2个变量,对象也不可迭代?
- 第四章 Python 对象