The following sections describe WebPage instances, AppSections, binding attributes of web pages, and WebPage methods.
Each WebApp is made up of one or more WebPages, which are identified by URLs. Although the Type attribute for a WebPage could be Single or Multi, the Single type WebPage (default type) is recommended for most use cases. When a Single type page is defined, only one instance of the page is associated with an instance of an application.
When a WebApp instance is created, all its Single page members are created and can be accessed for event registration. As the page instance remains the same whether or not it exists on the desktop, you need to verify that the page actually exists before performing actions on it.
In the Repository, WebPages are generated as members of the WebApp object. Therefore, to access a page, you need to first get a reference to an instance of the application (Working with WebApp).
Binding attributes of a web page are listed and described in the following table.
Attribute Name |
Description |
Required |
Default Value |
---|---|---|---|
ProgId |
Name of the page member in the application class. |
Yes |
|
URL |
A regular expression representing the URL identifying the page. |
Either the URL or the Title attribute is required. If desired, both may be used. |
|
Title |
The title of the page. Regular expressions are supported. |
|
|
Type |
•Single: Will create a typed member •Will create a typed IEnumerable member |
No |
Single |
For example:
<WebApplication ProgId="SalesForce" Type="Single"> <WebPage ProgId="ContactsPage" URL="http[s]://jacada.salesforce.com/.*/Contacts.*" Type="Single"> |
An AppSection object is used to define a section of a web page that remains unchanged despite the URL changing. This section of the page generally contains content that is common to all pages of an application (for example, a menu bar). Using an AppSection eliminates the need to define this common section for each individual page.
AppSections are automatically linked to the current page of the application, and can be used in a similar manner to pages. In the Repository, AppSections are defined alongside web pages without the URL binding attribute. For example:
<WebApplication ProgId="SalesForce" Type="Single"> <AppSection ProgId="MainMenu"> <WebLinkControl ProgId="MenuItemA" Id="fixedMenuId"/> </AppSection> <WebPage ProgId="ContactsPage" URL="http[s]://jacada.salesforce.com/.*/Contacts.*" Type="Single"> |
WebPage members are listed and described in the following table.
Member Name |
Type |
Description |
Default Value |
---|---|---|---|
Exists |
Boolean |
Indicates whether or not the page exists in a browser on the desktop. |
|
ParentTab |
Tab |
The tab hosting the page. |
|
Parent |
Browser |
The browser hosting the page. |
|
URL |
String |
The actual URL of the web page. |
|
WebPage methods are listed and described in the following table.
Method |
Return Type |
Description |
Parameters |
---|---|---|---|
Close |
|
Closes the tab that hosts the page. |
|
Execute |
string |
Executes JavaScript on the page. Note: When using this method, write your script with care. If the script involves exiting the webpage (through refresh, navigation, etc.), the script executes but a TimeOut exception is then thrown, as the script cannot be checked. |
•String Script: The JavaScript code to be executed on the page. |
WaitFor |
boolean |
Blocks the code until the page is loaded and ready for work. If the page is available when the method is called, the method will return immediately. The WaitForLoad function is relevant to Single tab applications and Single type pages only. |
•TimeSpan Timeout: The time to wait for the page to load before throwing a timeout exception. •bool WaitForReset: Indicates whether to wait for the page to reset. If the page is available when the method is called, setting this parameter to true will allow the page to unload first. |
Find<T> |
T : WebControl |
Finds descendant elements of a specific web control. The method accepts a Type that is a child of WebControl. This is the return value of the method. Keep the following principles in mind when working with this method: •Casting is done whether or not the actual result of the Find method is the correct control type. •As the method returns only a single item, verify that the selector is unique. •If no Type is passed, a generic WebControl will be returned. |
•String Selector: A jQuery selector to find descendants. •int Index: Index of the control, based on the selector to return. •bool ImmediateOnly: Indicates whether the method returns any matching descendants, or only the immediate children. |
FindAll<T> |
WebControlsCollection<T : WebControl> |
Similar to the Find method, but returns a collection of controls that can be iterated on. |
•String Selector: A jQuery selector to find descendants. •bool ImmediateOnly: Indicates whether the method returns any matching descendants, or only the immediate children. •int Skip: How many controls (from the beginning) should be skipped to get the first item. |
static AddWebAppMatcher |
|
Similar to the WebApp matcher method (a static method to add a matcher to the WebApp). |
•Delegate MatcherFunction: A reference to a delegate function that will get the WebPage as an attribute and return a matcher identifier. •Type PageType: The specific web page type the matcher is defined for. |
static AddWeb |
|
These predicate functions run for every new instance of a page, and indicate whether this is indeed an instance of the page (by returning true/false). |
•Delegate PagePredicate: A reference to a delegate function that will get a reference to the WebPage and return a boolean value indicating if this is indeed an instance of the page. •Type PageType: The specific web page type the predicate is defined for. |
WebPage events are listed and described in the following table.
Event Name |
Arguments |
Description |
---|---|---|
Loaded |
|
This event will fire each time an instance of the page is loaded. Once the user has a reference for the page, the event can be registered, even if the page doesn't yet exist in the browser. |
Unloaded |
|
This event will fire each time an instance of the page is unloaded. |