This chapter provides a complete listing and reference for the methods in the OpenScript BrowserService Class of Browser Utility Module Application Programming Interface (API).
The following section provides an alphabetical listing of the methods in the OpenScript BrowserService API.
The following table lists the BrowserService API methods in alphabetical order.
Table 18-1 List of BrowserService Methods
Method | Description |
---|---|
Clear the browser. |
|
Closes the Browser. |
|
Closes all instances of the browser created by the current user including browser instances created outside of OpenScript. |
|
Gets the current browser. |
|
Gets the browser launch process id. |
|
Get the Firefox Utility to retrieve information about the Firefox browser. |
|
Gets the browser settings. |
|
Launch the browser specified in BrowserSettings.getBrowserType(). |
|
Sets the browser type. |
The following sections provide detailed reference information for each method and enum in the BrowserService Class of Browser Utility Module Application Programming Interface.
Clear the browser. Sets Browser to null when the user makes the BHO to close the browser.
The browser.clearBrowser method has the following command format(s):
browser.clearBrowser( );
Clear the browser.
browser.clearBrowser();
Closes the Browser.
The browser.close method has the following command format(s):
browser.close( );
represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.
Close the browser.
browser.close();
Closes all instances of the browser created by the current user including browser instances created outside of OpenScript.
The browser.closeAllBrowsers method has the following command format(s):
browser.closeAllBrowsers( );
represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.
Close all browser instances created by the current user.
browser.closeAllBrowsers();
Gets the current browser.
The browser.getBrowser method has the following command format(s):
browser.getBrowser( );
Current browser. Returns null
if no browser has been launched yet.
Get the current browser and print its path.
IBrowser browser1 = browser.getBrowser();
info(browser1.getBrowserPath());
Gets the browser launch process id.
The browser.getBrowserProcessID method has the following command format(s):
browser.getBrowserProcessID( );
the browser launch process id.
Gets the current browser process id and print it.
long pid = browser.getBrowserProcessID();
info("Browser PID:"+pid);
Get the Firefox Utility to retrieve information about the Firefox browser.
This utility is used to retrieve information, set Firefox preferences during playback, (for example, get a list of all installed extensions), or to disable popup windows during playback.
The browser.getFirefoxUtility method has the following command format(s):
browser.getFirefoxUtility( );
FirefoxUtility an instance of the FirefoxUtility.
Get the Firefox Utility and then get all installed extensions.
FirefoxUtility firefoxUtility = browser.getFirefoxUtility();
List<String> extensions = firefoxUtility.getAllInstalledExtensions();
Gets the browser settings.
The browser.getSettings method has the following command format(s):
browser.getSettings( );
All settings pertaining to the Browser Service.
Get the browser settings and then get the browser type.
BrowserSettings settings = browser.getSettings();
info(settings.getBrowserType().toString());
Launch the browser specified in BrowserSettings.getBrowserType().
The Browser will use any additional parameters specified in the BrowserSettings.getExtraParams()
setting. BrowserService will automatically determine the appropriate path for the specified browser type. If specified, BrowserSettings.getBrowserPathOverride() will be used for the browser path instead of the automatically determined path. If the BrowserService's browser is already running, launch() will do nothing.
The browser.launch method has the following command format(s):
browser.launch( );
represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.
Launch the browser.
browser.launch();
Sets the browser type.
The browser.setBrowserType method has the following command format(s):
browser.setBrowserType(browserType);
BrowserType enum specifying the supported browser types. For example, BrowserType.InternetExplorer.
if browser type cannot be changed.
Sets the browser type.
//Specify Browser as Mozilla Firefox. browser.setBrowserType(BrowserType.Firefox); //Specify Browser as Internet Explorer. browser.setBrowserType(BrowserType.InternetExplorer); //Specify Browser as Chrome. browser.setBrowserType(BrowserType.Chrome);