IE Browser
The Browser control manages the display and interaction with a web browser. It allows for direct access to and manipulation of document elements including forms and form elements.
Properties
- FieldName:Â A string representing the name of the control. This can be used for retrieving the control.
- Label:Â A string representing the label that should be displayed beside the field on the form.
- LabelVisible:Â A boolean value representing whether or not the label should be displayed.
- TypeName:Â A string representing the full name of the control type.
- WebBrowser:Â The underlying IE WebBrowser object being managed by this control.
Methods
- CheckHandlerQueue():Â Forces an immediate check of the page handler queue. This is primarily used when JavaScript and AJAX enabledpages perform updates that do not require an actual page change in thebrowser, but need to be detected and checked by the browser.
ClickObject(string objectId): Searches for an element on the page whose ID matches the objectId provided and attempts to invoke the object's Click member. If no elements are found using an ID, a search will be done based on element names rather than ID. In this case, the object will only be considered a match if it is the only object with the given name. This is equivalent to calling ClickObjectInFrame with a nil frameName.
Parameter Direction Parameter Name Description Input objectId The ID of the element to be clicked.
ClickObjectByReference(HtmlElement clickableObject): Attempts to invoke the provided object's "Click" member. The object does not need to be a button, most elements will have a click member.
Parameter Direction Parameter Name Description Input clickableObject An HtmlElement object that contains a
"Click" member.
ClickObjectInFrame(string objectId, string frameName):Â Searches for an element with an id matching objectId that is contained in a frame with a name matching frameName. If the frame cannot be found or if frameName is nil, it will attempt to use the current page's primary frame. Once a matching element is found, the element's "click" member is invoked.
Parameter Direction Parameter Name Description Input objectId The ID of the element to be clicked Input frameName The name of the frame in which to search for the element GetElementByCollectionIndex(HtmlElementCollection collection, int index): Returns the HtmlElement that is assigned to the provided index of the provided collection. This method is no longer necessary as the system now supports the get_Item syntax for retrieving indexed items - collection:get_Item(0) is the same as GetElementByCollectionIndex(collection, 0)
Parameter Direction
Parameter Name
Parameter Description
Input
collection
The HtmlElementCollection in which to search
Input
index
The index of the element to return
Output
HtmlElement
GetElementByWindowIndex(HtmlWindow window, int index):Â Returns the HtmlElement that is assigned to the provided index of the given window's collection of HtmlElements. This collection of elements contains ALL valid html elements in the frame.
Parameter Direction
Parameter Name
Parameter Description
Input
window
The window in which to search
Input
index
The index of the element to return
Output
HtmlElement
GetElementInFrame(string frameName, string elementId):Â Attempts to locate an element with the specified ID in the frame whose name matches the specified frame name.
Parameter Direction
Parameter Name
Parameter Description
Input
frameName
The name of the frame to search in
Input
elementId
The id of the element to search for
Output
HtmlElement
GetForm(HtmlWindow window, string formNameId):Â Attempts to locate the specific form element in the specified HtmlWindow by looking for forms whose name or id match the value specified. If window is nil, the search will begin in the base frame and search accessible frames recursively until a match is found.
Parameter Direction
Parameter Name
Parameter Description
Input
window
The HtmlWindow in which to search
Input
formNameId
The id or name of the form to look for
Output
HtmlElement
GetFormElementFromForm(HtmlElement form, string fieldName):Â Attempts to locate a field owned by the form provided whose name or id matches the field name provided.
Parameter Direction
Parameter Name
Parameter Description
Input
form
The form to searchfieldName - the name of the field to search for
Output
HtmlElement
GetFormElementFromFormName(string formName, string fieldName):Â Attempts to locate a form whose name matches the form name provided, and if successful attempts to locate and return the element inside that form whose name matches the field name provided.
Parameter Direction
Parameter Name
Parameter Description
Input
formName
The name of the form in which to search
Input
fieldName
The name of the field to search for
Output
HtmlElement
GetFrameByName(HtmlWindow window, string frameName):Â Attempts to locate a frame whose name matches the frameName provided. If window is nil, the search will begin in the page's base frame. If the frame cannot be found in the starting frame, a recursive search will be done on all of the frames contained in the starting frame.
Parameter Direction
Parameter Name
Parameter Description
Input
window
The window in which to begin the search
Input
frameName
The name of the frame to search for
Output
HtmlWindow
GetFrameByWindowIndex(HtmlWindow window, int index):Â Returns the HtmlWindow assigned to the specified index of the collection of frames belonging to the provided HtmlWindow.
Parameter Direction
Parameter Name
Parameter Description
Input
window
The window in which to search
Input
index
The index of the frame to return
Output
HtmlWindow
GetParentElement(HtmlElement source):Â Returns the element that is currently the parent of the HtmlElement provided.
Parameter Direction
Parameter Name
Parameter Description
Input
source
The element for which the parent is to be retrieved
Output
HtmlElement
Navigate(string url):Â Attempts to load the specified url into the browser.
Parameter Direction
Parameter Name
Parameter Description
Input
url
The url to navigate to
RegisterPageHandler(string idType, string id, string handlerName, bool critical):Â Registers a new page handler for use in detecting when pages that have automated actions associated with them are loaded and alerting the addon script to respond to the page load.
Parameter Direction
Parameter Name
Parameter Description
Input
idType
The type of matching that should be done against the given id
Input
id
The id to match against
Input
handlerName
The name of the Lua method that should be called when the page handler is invoked
Input
critical
Whether or not the page handler is considered a critical page handler, which should exist outside of the normal queue and should be checked every time the the system checks for a page match
A detailed description of the page handler types and how each works is listed in the Page Handlers section.
SetFormValue(object form, string fieldName, string value):Â Attempts to locate the specified field in the provided form and set the field's value to the value provided.
Parameter Direction
Parameter Name
Parameter Description
Input
form
An HtmlElement representing the form, or a string containing the name of the form, whose field should be set
Input
fieldName
The name of the field that should be set
Input
value
The new value the field should be set to
StartPageWatcher(double checkInterval, double maxWatchTime):Â Starts the page watcher, which will check the page handler queue (and critical page handlers) at an interval defined by checkInterval. If no match is found when the maxWatchTime is reached, the handler will stop. This is primarily used on pages that use AJAX or other similar methods to make dynamic changes to the page content without actually changing pages. In these cases, a page watcher can be started before performing an action that will cause a page update so that the new page state can be checked.
Parameter Direction
Parameter Name
Parameter Description
Input
checkInterval
The interval, in milliseconds, that the page handler queue should be checked
Input
maxWatchTime
The maximum amount of time,in milliseconds, the page watcher should run before stopping
If the page has a feature that allows detection of update completion, it may be slightly more efficient to check for that and call CheckHandlerQueue when the update is complete; though the page watcher is still quite efficient and often easier.
- StopPageWatcher():Â Stops the page watcher so that it will not perform any more checks on the page handler queue
SubmitForm(string formName):Â Attempts to find the form and invoke the form's "submit" member.
Parameter Direction
Parameter Name
Parameter Description
Input
formName
The name or id of the form to submit