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

API Guide - File

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      
Class WET::WebFile
In: WebFile.rb
Parent: WebObject

# Class to represent a Filefield object on the browser

    The controls that allow you to upload files are the File objects.

Methods

Methods Inherited from WebObject

browser   exists?   fire_event   id   index   is_exist   name   tag_name  

Public Class methods

    Create a new instance of the WebFile object.Scripts should not directly try to create instances of this object.
    Instead they should use the File("args)method of the WebContainer.File(*args)to create an instance.

    The controls that allow you to upload files are the File objects.

    1) Getting a reference of the required File
     The syntax to get the reference of a File is :
     Container.File("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").File("label:=Upload audio")
     The commonly used attributes to identify a radio are:
     name           The HTML name attribute of the File control
     id        The HTML id attribute of the File control
     label         The label for this File control

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

Public Instance methods

Check whether the Filefield actually exists on the page.If the filefield 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.

Checks whether the Filefield *does not* exist on the page.If the filefield 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.

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 File control.

      The commonly used ones are:

        name    -      The html name attribute of the File control
        id      -      The html id attriute of the File control
        label   -      The label for this File control
        suffix  -      The suffix that is immediately after the Filefield
        value   -      The path of the Filefield

Besides the above properties you could use any of the properties of the MSHtml File object.The properties are enumerated at:msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/input_file.asp If the result is a success then prints a Success to the report.Otherwise prints a failure.

Set the text of this File control to the path name passed as parameter.The path is only set if it is a file that exists on the system.If the path doesn’t exist then the method raised a RuntimeError.

Gets the value for this file field. Value is the full path of the file that this field represents.

Methods inherited from Web Objects

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