Open source web testing tool
The future of automated web testing is open source

API Guide - Selectlist

Courses in c#, ruby, shell scripting, Software testing courses and more

See a video tour
Thwameva technologies offers a state of the art advanced training using multimedia video mentoring , practical oriented training and experts as mentors(*). Thwameva offers software testing courses, courses in WET, ruby, C#, shell scripting and more...
The unique combination of video mentoring by experts and mentor assisted training programs are applicable only for software training courses in Thwameva's Bangalore office.

Thwameva technologies is the primary sponsor for the WET project
 
Main       Web Objects       Win Objects       Test Mgmt       Others      

Wrapper for Watir::SelectBox. Most functionality is handled by Watir.

The control that typically display many items out of which you may select one or more.Select Lists are either ‘fixed height’or ‘dropdown’.In case of the former,the items are displayed in a list whose height is always the same.In the latter,the selectable items are hidden,which can be exposed by expanding the drop-down.

Methods

Common methods for all web elements. This module is inserted into all Web objects as a mixin.

Methods inherited from WebObject

browser   exists?   fire_event   id   index   is_exist   name   tag_name  

Public Class methods

    Create a new instance of the WebList.Scripts should not directly instantiate Wen Lists.Instead they should call

the WebContainer.List(*args)method provided by containers like browser / frames.

    This is to initialize the the Weblist.

    The syntax to get the reference of a List is:
    Container.List("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').List('name:='ls001')

      The commonly used attributes to identify a List are:
      id    The HTML id attribute of the List
      name  The HTML name attrobute of the List
      label The label for the List control

     Tip:To construct the definition for a List,use the container's show_objects('List')method.Then pick the one that
     is appropriate for the image of interest and copy paste it into your script.

Public Instance methods

Get all the items in the WebList as an array. This command is used to find all the elements of a select list box.The items are returned as an array.

Check to see if the weblist actually exists on the page.If the weblist 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 acutally does exist.

Check to see if the weblist *does not* exist on the page.If the weblist 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 immediately 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 List.

The commonly used ones are:

     name                -     The html name attribute of the List
     id                     -     The html id attribute of the List
     label                 -     The label for this List
     selectedindex     -     The numberic index denoting the item that is currently selected.
     selected_items   -      Check all the selected items. The selected items is a string formed by concatenating all the selected items.

Besides the above properties you could use any of the properties of the MSHtml Select object.The properties are enumerated at: msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/select.asp

If the result is a success then prints a Success to the report.Otherwise prints a failure.

This is the opposite action of ‘select’.Here tit clears all selection in the WebList.

Returns a true value if the value is listed in the weblist else returns false.

This method is used to select the specified item in the list.This command is equivalent to the user actually selecting the specified item.to_select String/Regex if a single item is to be selected.Array of String/Regex if multiple items are to be selected. Raises NovalueFoundException if the item is not found.

Get an array of selected items from the list.

    This command is used to find the elements that have been selected in a select list box.The items are returned
    as an array.

    In some cases,more than one item may be selected if the Select box's type has been set to 'select-many'.
    Otherwise only one item is selected.

Public Instance methods

Get the WebBrowser object which hosts this element

Check to see if the object exists or not at runtime.

Returns true if the object exists, false if it doesn’t

Emulate firing an event - For example - moving mouse over, etc,.

Get the ‘id’ attribute that is associated with this element

Get the index of this element w.r.t its container.

is_exist()

Alias for exists?

Get the ‘name’ attribute that is associated with this element

Get the html tag of this element. For example: <input> for textfield, <img> for image, etc.,

 

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.

WWW wet.qantom.org
Search powered by Google