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

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

Table元素

HTML tag - <table>

 

可以用来定位的方法有:

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

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

Browser.table(:index,  0)

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

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

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

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

 

Text_field元素

HTML tag - <input type=”password”>/<input type=”text”>

 

可以用来定位的方法有:

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

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

Browser.textfield(:index,  0)

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

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

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

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

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

Textarea元素

HTML tag - <textarea>

 

可以用来定位的方法有:

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

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

Browser.textarea(:index,  0)

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

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

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

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

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

 

ul元素

HTML tag - <ul>

 

可以用来定位的方法有:

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

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

Browser.ulist(:index,  0)

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

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

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

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

 

New Browser Windows对象

可以用来定位的方法有:

Browser.window(:href,  “new window href”)

Browser.window(:title,  “new window title”)


TAG:

 

评分:0

我来说两句

日历

« 2024-05-05  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

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

RSS订阅

Open Toolbar