![]()
API Guide - Checkbox |
Courses in c#, ruby, shell scripting, Software testing courses and more
|
|||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| Class | WET::WebCheckbox |
| In: |
WebCheckbox.rb
|
| Parent: | WebObject |
Wrapper to represent a Web checkbox.
The checbox controls that are displayed on the web page.
Create a new WebCheckbox instance.Scripts should not directly instantiate a WebCheckbox directly.Instead you should call the Checkbox method of the WebContainer.Checkbox(*args)method.
The checkbox controls that are displayed on the web page. 1)Getting a reference of the required checkbox
The syntax to get the reference of a Checkbox is:
Container.Checkbox("name:=value")
Where
Container is a Browser,Frame,Table or any other container that can hold HTML elements as its children
name is the name of the attribute to be checked
value is the value of that attribute.
Example
Browser("title:=Controls").Checkbox("label:=Are you sure")
The commonly used attributes to identify a checkbox are:
name The HTML name attribute of the checkbox
id The HTML id attribute of the checkbox
label The label for this checkbox
Tip:To construct the definition for a radio,use the container's show_objects('Checkbox')method.Then pick the
one that is appropriate for the Checkbox of interest and copy paste it into your script.
Check to see if the checkbox actually exists on the page.If the checkbox actually does exist,then prints out a success message in the test report.If it doesn’t exist,then it prints out a failure in the report. One example of using this check is immediately after performing ‘add’operations.For example,after adding a new user,you may want to check that the user link actually does exist.
Check to see if the checkbox *does not*exist on the page.If the checkbox does not exist,then prints out a success message in the test report.If it actually does exist,then it prints out a failure in the report. One example of using this check is immedaiately after performing ‘delete’ operations.For example,after deleting user ‘abc’,you may want to check that the user link for ‘abc’has been deleted.
This method is used to verify that the current value of ‘name’property matches the expected value.The property to be checked is the first parameter and the expected value is the second parameter.There are various properties that you can use for a checkbox.The commonly used ones are:
name The html name attribute of the checkbox
id The html id attribute of the checkbox
label The label for this checkbox
suffix The suffix for a checkbox is the text that is immediately after the checkbox.This is typically used
when the checkbox's identification text is place immediately after the checkbox and this string is NOT set as
(html)label for the checkbox itself
checked Whether or not the checkbox in the checked state.
Besides the above properties you could use any of the properties of the MSHtml checkbox object.The properties are enumerated at: msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/input_checkbox.asp
If the result is a success then prints a Seccess to the report.Otherwise prints a failure.
Clear is the flip operation of Set.In this case the checkbox’s state is set to UNCHECKED.It is equivalent to clicking the checkbox when it is initially checked.
This method checks if the checkbox is set to ON state after we have set the checkbox to ON.If it is not set to ON, then it prints as failed.
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. |