This functionality is supported only if you are using the Classic Agent. For additional information, refer to the Silk Test Classic Classic Agent Help.
Silk Test Classic supports different Web browsers and uses "browser specifiers" so that you can explicitly specify a particular browser in a script. The following table lists the most commonly used browser specifiers.
For information about new features, supported platforms, and tested versions, refer to the Release Notes.
Browser Specifier | Browser |
---|---|
explorer | Set that includes the following browser versions:
|
explorer6_DOM | Internet Explorer 6 |
explorer7 | Internet Explorer 7 |
explorer8_0 | Internet Explorer 8 |
explorer_DOM | Set that includes the following browser versions:
Note: "explorer_DOM" is identical with "explorer" and exists only for backward compatibility.
|
firefox | Set that includes the following browser versions:
|
firefox1_5 | Mozilla Firefox 1.5 |
firefox2_0 | Mozilla Firefox 2.0 |
You can use a browser specifier in a script in two ways:
You set the browser in the Runtime Options dialog box or by calling the SetBrowserType or SetDefaultBrowserType function, each of which takes an argument of type BROWSERTYPE. If you do not set a browser type explicitly in a script, Silk Test Classic uses the browser specified in the Runtime Options dialog box.
If you try to use a browser specifier instead of a GUI specifier to specify a window, Silk Test Classic generates an error. The primary use of browser specifiers is to address differences in window declarations between different browsers. Each Agent connection maintains its own browser type, allowing different threads to interact with different browsers.
browserApplication.getProperty("browsertype")
A browser specifier has the following syntax:
[[browser-type [, browser-type]...] | [! browser-type]]
For example, you can specify one or more browser types separated by commas, such as:
firefox, explorer
You can also specify all but one browser, such as the following, which indicates that what follows applies to all browsers except Firefox:
! firefox
In the following code fragment, Mozilla Firefox and Internet Explorer browser specifiers are used to indicate that the tag for the BrowserAuthentication window differs in the two browsers.
[-] window DialogBox BrowserAuthentication [ ] explorer, msw2000 tag "Enter Network Password" [ ] explorer, mswxp tag "Authentication" [ ] explorer, msw2003 tag "Basic Authentication"
The test case in the next example (GetItemCount) takes an argument of type BROWSERTYPE, allowing you to pass browser specifiers at runtime. (The test case uses the recovery system and assumes that wMainWindow is set to the GMO Web application's Welcome page, whose identifier is GMO.)
This example uses the main function to pass the arguments. For more information on passing data to a test case, see the example on generalizing test cases.
[-] main () [ ] LIST OF BROWSERTYPE lbtType [ ] BROWSERTYPE btType [ ] lbtType = {explorer7, firefox1_5} [-] for each btType in lbtType [ ] GetItemCount (btType) [ ] [-] testcase GetItemCount (BROWSERTYPE btType) [ ] GMO.About.Click () [ ] INTEGER iCount [ ] iCount = AboutPage.UsedList.GetItemCount () [ ] Print (btType) [ ] Print ("Item count: {iCount}") [ ] [ ] // Results: [ ] // Testcase GetItemCount (explorer7) - Passed [ ] // Internet Explorer 7.0 [ ] // Item count: 9 [ ] // Testcase GetItemCount (firefox1_5) - Passed [ ] // Mozilla Firefox 1.5 [ ] // Item count: 9