![]()
API Guide - Frame |
Courses in c#, ruby, shell scripting, Software testing courses and more
|
|||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| Class | WET::WebFrame |
| In: |
WebFrame.rb
|
| Parent: | WebCommonFrame |
Class to represent a web frame object
For those web pages that are displayed in a frameset,WET's Frame object can be used to get a reference of the Frame.To find out all the frames shown in a Browser,you need to use the Browser's show_frame method.
| container | [R] |
Constructor to create a new instance of the frame object.Scripts should not directly invoke the Frame method
of the Browser class = Browser.Frame(*args)
This command is to get the frame with the specified properties.
1) Getting a reference of the required Frame
The syntax to get the reference of a Frame is :
Browser.Frame("name:=value")
Where
name is the name of the attribute to be checked.
value is the value of that attribute.
Browser('title:=Controls').Frame('name:=fr001')
The commonly used attributes to identify an Image are:
text The text of this Frame
name The HTML name attribute of the frame
id The HTML id attribute of the frame
1) Write the following script in a new ruby file
#####################################
require 'WET'
include WET
ie = Browser.new()
ie.goto "http://www.wet.qantom.org/userguide/frameset.html"
tf = ie.Frame('name:=top')
puts tf.text
#####################################
2) Execute this script
The following output should be printed on the console
THIS IS THE TOP FRAME
Get a frame with the specified properties.The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression.To emulate a regular expression,the value starts and ends with the ’/’ character.For example: "name:=/some.*/"
The different properties that can be used to identify a frame are:
name - The html name attribute of the frame
id - The html id attribute of the frame
index - The order in which this frame appears on the webpage.
Find a Button with the specified properties, The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The common properties used to identify a button are :
Find a Web checkbox with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a checkfield are:
displayed to the left of the checkbox.
Find a Web File with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a File are:
text displayed to the left of the file.
Find an IFrame with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a Textarea are:
Find an Image with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The common properties for an image are
Get a web Link with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
For a link the following are the commonly used properties:
Find a Web List with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a List are:
displayed to the left of the weblist
Find a Web radio button with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a radio button are:
label is considered to be the textimmediately after the radio.
Find a HTML Table with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties with which a table can be identified are:
info that is available about a table is the text contained in the table. The table's text is the aggregate of the contents of the cells of the table.
Find a Web textfield with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a textfield are:
displayed to the left of the textfield.
Find a Textarea with the specified properties. The properties are specified as name-value pairs using the syntax:
"property_name:=value"
The value can either be a string literal or a string representing a regular expression. To emulate a regular expressioin, the value starts and ends with the ’/’ character. For example, "name:=/some.*/"
The properties used to identify a Textarea are:
Get an element based on the tagname. This is useful for those cases where there is no predefined WET class for a particular tag but a scripter needs to use it.
For example if you want to get a <div> element whose id is ‘myId’, then you can say
element_by_tag_name("div", "id" => "myId")
Check to see if the object exists or not at runtime.
Returns true if the object exists, false if it doesn’t
| WET is a opensource automated web testing tool which uses Watir as the library to drive web pages. WET drives an IE Browser directly and so the automated testing done using WET is equivalent to how a user would drive the web pages. WET extends the scripting abilities of Watir and also offers the convenience of recorders. It is licensed under LGPL and BSD style open source licenses. |