How to identify various HTML Objects in Watir

Source: Internet
Author: User

On Watir's Wiki, we were excited and excited. Thanks to these enthusiastic colleagues for organizing these valuable materials. Comrades, we all want to learn from "Lei Feng" abroad!
In addition, it is recommended that you learn the Document Sorting and writing skills.

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, includingRowAndCellMethods for accessing nested elements.
Image 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 Used to find an element that has an "id =" attribute. since each id shoshould be unique, according to the XHTML specification, this is recommended as the most reliable method to find an object. *
: Name Used to find an element that has a "name =" attribute. This is useful for older versions of HTML, but "name" is deprecated in XHTML .*
: Value Used to find a text field with a given default value, or a button with a given caption, or a text field
: Text Used for links, spans, divs and other element that contain text.
: Index 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.
: Class Used for an element that has a "class =" attribute.
: Title Used for an element that has a "title =" attribute.
: Xpath Finds the item using xpath query.
: Method Used only for forms, the method attribute of a form is either GET or POST.
: Action Used only for form elements, specifies the URL where the form is to be submitted.
: Href Used to identify a link by its "href =" attribute.
: Src Used to identify an image by its URL.

*: IDAnd: NameAre the quickest of these to process, and so shoshould be used when possible to speed up scripts.

Supported Methods by Element
  : Id : Name : Value : Text : Caption : Index : Class : Xpath : Title : Method : Action : Href : Src Multiple attribute support?
Button
Radio
Check_box
Text_field
Hidden
Select_list
Label
Span
Div
P
Link
Table
Image
Form
Frame
Map
Area
Li

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

From: http://www.cnblogs.com/jackei/archive/2007/06/22/792839.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.