共同探讨QTP相关问题
HTML Elements supported by Watir
上一篇 /
下一篇 2008-09-07 14:07:02
/ 个人分类:Automation Test
The HTML Elements that are currently supported include:
button |
<input> tags with type=button, submit, image or reset |
radio |
<input> tags with the type=radio; known as radio buttons |
check_box |
<input> tags with type=checkbox |
text_field |
<input> tags with the type=text (single-line), type=textarea (multi-line), and type=password |
hidden |
<input> tags with type=hidden |
select_list |
<select> tags, known as drop-downs or drop-down lists |
label |
<label> tags (including "for" attribute) |
span |
<span> tags |
div |
<div> tags |
p |
<p> (paragraph) tags |
link |
<a> (anchor) tags |
table |
<table> tags, including row and cell methods for accessing nested elements. |
image |
<img> tags |
form |
<form> tags |
frame |
frames, including both the <frame> elements and the corresponding pages. |
map |
<map> tags |
area |
<area> tags |
li |
<li> tags |
:id 51Testing软件测试网7Gm0Xn1u[G|h bI
Used to find an element that has an "id=" attribute. Since each id should be unique, according to the XHTML specification, this is recommended as the most reliable method to find an object. *51Testing软件测试网?3bn,fc)K{}
lx&ic k:ZpIQ+w0:name
mp5a$_$XJa0 Used to find an element that has a "name=" attribute. This is useful for older versions of HTML, but "name" is deprecated in XHTML. *
/O]SBhg0
X.GUTn+{&R1V$Bk0:value
K+f1d3c(sIx&e:C0 Used to find a text field with a given default value, or a button with a given caption, or a text field 51Testing软件测试网C'NR!?0{%a6a%n
[-K
V~
Kp%jR*|0:text
6B2ve)CvH0 Used for links, spans, divs and other element that contain text.51Testing软件测试网4zE a,n
iGG|-^G
51Testing软件测试网dZ9TH_1ifO
:index
-c+I#^%q+Ry*~z0 Used to find the nth element of the specified type on a page. For example, button(:index, 2) finds the second button. Current versions of WATIR use 1-based indexing, but future versions will use 0-based indexing.
j*N$C\ g/h'YD0 51Testing软件测试网*A_6hG9D%j&P"^4_
:class
`9l!uH!d(D5oW,M1e0 Used for an element that has a "class=" attribute.
C;L4Q MP)wtru,L0
S
E/Z&Pe vv+u.Z0:title 51Testing软件测试网qpW] l,K
Used for an element that has a "title=" attribute.51Testing软件测试网)v?D5y-UY7cI
51Testing软件测试网*R2H4l:z @nM\"mX
:xpath
(H@A6SwP8V
xim0 Finds the item using xpath query.
GnG/[!\O0Nlr]0 51Testing软件测试网:IW"N*eME#Nl
:method 51Testing软件测试网C8PXK-C%Y1R
Used only for forms, the method attribute of a form is either GET or POST.51Testing软件测试网*b5M,i.?O
51Testing软件测试网0e8MH2V~
}{
:action 51Testing软件测试网-j$@/I;I4zd#d@
Used only for form elements, specifies the URL where the form is to be submitted.
{)KqAm0 51Testing软件测试网+Q!N2Ym T
:href
;Z(E&z%h%e0 Used to identify a link by its "href=" attribute.
*AC Q;bK&z.|3~n,P*u0
e!x^rd{H-Old0:src
5Ym$?f}][;}"T)e8o2p0 Used to identify an image by its URL.51Testing软件测试网iLfT'C
Ri+?:v)U6S
'l#A3V.n4x2L9Q1m6i`c0* :id and :name are the quickest of these to process, and so should be used when possible to speed up scrīpts.
s/T8|wS#g:?0原文地址:http://wiki.openqa.org/display/WTR/Methods+supported+by+Element
3h,NZPoqPy0
收藏
举报
TAG: