如何在 Watir 中识别各种 HTML 对象(2)

上一篇 / 下一篇  2013-01-14 17:47:48 / 个人分类:测试

Area元素

HTML tag - <area>

可以用来定位的方法有:

Browser.area(:class,  “area class name”)

Browser.area(:id,  “area id”)

Browser.area(:index, 0)

Browser.area(:name, “area name”)

Browser.area(:text, “area text”)

Browser.area(:xpath, “area xpath”)

Browser.area(:class=>“area class name”, :id=>“area id”, :index, 0) (Mulitple Attributes)

 

Button元素

HTML tag - <button>/<input type=”button”>/<input type=”image”>/<input type=”reset”>

/<input type=”submit”>

 

可以用来定位的方法有:

Browser.button(:alt,  “alt button name”)

Browser.button(:class,  “button class”)

Browser.button(:id,  “button id”)

Browser.button(:index,  0)

Browser.button(:name,  “button name”)

Browser.button(:src,  “image button src”) (only for type is image)

Browser.button(:text,  “button text”)

Browser.button(:value,  “button default value”)

Browser.button(:xpath,  “button xpath”)

Browser.button(:class=>“button class name”, :id=>“button id”, :index, 0) (Mulitple Attributes)

 

Cell元素

HTML tag - <td>

 

可以用来定位的方法有:

Browser.td(:alt,  “alt button name”)

Browser.td(:class,  “td class”)

Browser.td(:id,  “td id”)

Browser.td(:index,  0)

Browser.td(:name,  “td name”)

Browser.td(:text,  “td text”)

Browser.button(:xpath,  “td xpath”)

Browser.button(:class=>“td class name”, :id=>“td id”, :index, 0) (Mulitple Attributes)

 

 

Checkbox元素

HTML tag - <input type=”checkbox”>

 

可以用来定位的方法有:

Browser.checkbox(:class,  “checkbox class”)

Browser.checkbox(:id,  “checkbox id”)

Browser.checkbox(:index,  0)

Browser.checkbox(:name,  “checkbox name”)

Browser.checkbox(:text,  “checkbox text”)

Browser.checkbox(:value,  “checkbox value”)

Browser.checkbox(:xpath,  “checkbox xpath”)

Browser.checkbox(:class=>“checkbox class name”,  :index, 0) (Mulitple Attributes)


TAG:

 

评分:0

我来说两句

日历

« 2024-05-18  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 152854
  • 日志数: 185
  • 文件数: 6
  • 建立时间: 2007-08-06
  • 更新时间: 2015-01-06

RSS订阅

Open Toolbar