单选按钮是个常见的html元素,在网页中往往提供一组单选按钮来做选项. 这样在自动化测试用例中需要判断当前选中的按钮是否与预期的一直. 可以这样来操作: ${value} Get Element Attribute xpath=//form[@id='xxx']/*/input[@value='yyy']@checked 上面的关键字Get Element Attribute是获取html元素的指定属性的属性值.该关键的字的参数是 元素定位符后加上@要获取的属性名 上面例子是获取 c…
做个记录,以便需要拿取 <script type="text/javascript"> $(function(){ 第一种 $('input:radio').click(function(){ //alert(this.checked); // var domName = $(this).attr('name'); var $radio = $(this); // if this was previously checked if ($radio.data('waschec…
项目中用的jquery-1.11 今天需要检测一个checkbox的选中状态,想当然的用 .attr("checked") ,结果发现,无论是否选中,这个值都是 undefined 未定义. 折腾了半天,发现:As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. In addition, .attr() should not be used on pla…