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

API Guide - Utilities

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      

General utilties that are used in various places in the package.


Public Instance methods

Return a compact representation of the string. Usually used for making a neat representation of long strings.

The first argument is the string to be compacted.

The second argument is an optional argument - The maximum number of characters to use at the start of the returned value. If nothing is specified, defaults to 10

The third argument is an optional argument - The number of characters to print at the end of the output string. If nothing is specified, defaults to 5

If the string is greater than <size>, then only the first <size> characters are displayed at the begining of the output. If the string size is greater than <size> + <tail>, then all other characters inbetween the begining and last <tail> characters are skipped and three dots are displayed instead.

For example, if the you say: compact("These are long sentence which are not to be seen completely", 5, 5), then the output looks like:


Compare a string with another string or regular expression.

The first argument is the string that we want to compare. The second argument is the reference string or regular expression against which the first argument must be compared.

If the second argument is a string, then an exact match search is done. If the second argument is a regular expression, then a regex match is done.

returns true if the two arguments match, false otherwise.

Method used for debugging.

Get a ‘Processed’ value for the string argument passed. Depending on the string format, the returned value could be the string itself or could be ‘a ruby evaluated value’. If the string begins with ‘eval’ then the text following ‘eval’ is actually evaluated. Otherwise the string itself is returned. Eg. eval_parameter("ruby is good") returns "ruby is good"

eval_parameter("eval ENV[‘QWT_HOME’]/bin") returns


Note that the parameter to evaluate can only be string concatanation You cannot say "eval 3+2" and expect an answer of 5

Convert a path into an absolute path. Also if the incoming path is in unix style (’/’ as separator), converts it to dos style. If the second optional parameter is specified as false, then ’’ is not added to the end of the path

Utility method to construct a dictionary of parameters using an array of arguments.

Using the previous style of coding WET, when you need to identify objects, you had to say, Object("name:=n1"; "id:=i1" …). The idea is that all the arguments have to be matched to declare success.

This method takes a multiple argument list and converts into a dictionary of name-value parameters.

While processing the arguments, if any of the ‘value’ in the name-value pair looks like a regular expression, then the dictionary’s value is a Regex instance instead of a string

Whether or not the passed string can be converted to an integer. Ruby doesn’t seem to have a direct method equivalent to :

    Integer.parseInt(String text) ;

Returns true if the string passed can be converted to an integer or false if the string cannot be converted.


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.

Search powered by Google