BrowserWindow Class

Description

A browser window is the top-level container for a web page. It exposes the DOM tree through DomElements. E.g. a tab in IE7, an embedded browser control in SWT.

Inheritance Hierarchy

Syntax

C#
public class BrowserWindow : BrowserObject, 
VB
'Declaration
Public Class BrowserWindow _
Inherits BrowserObject

Properties

Name Description
Text The text of the control. (Inherited from TestObject)
Value The value of the control, e.g.: text in a text control. (Inherited from TestObject)
ViewportHeight The height of the browser viewport
ViewportName The name of the viewport that matches the innerWidth and innerHeight of the browser window
ViewportOrientation The orientation of the browser viewport, this can be portrait or landscape
ViewportWidth The width of the browser viewport
Visible Whether the object is visible. You can only locate visible objects, so by default the value is always true. However, you might need this property when an already located object in the application under test gets invisible during replay. (Inherited from BrowserObject)

Methods

Name Description
AcceptAlert Accepts a JavaScript alert by pressing OK.
Back Goes back in the history.
CaptureBitmap Saves a bitmap image of this object to a file. If you do not specify an absolute file name, the bitmap is saved to the default bitmap location on the machine that runs the Agent, which is %LOCALAPPDATA%/Silk/SilkTest/capturedBitmaps. The captured bitmap's pixels are stored in 32bit RGB order; when parsing the image the 4th byte (alpha channel) of every pixel must be ignored as it is used only for padding. In .NET, the constant System.Drawing.Imaging.PixelFormat.Format32bppRgb can be used for this purpose. (Inherited from TestObject)
CaptureFullPageBitmap Capture a screenshot of the whole web page and save it as a file to the specified path. The filename extension determines the file type. Possible extensions are .jpg, .jpeg, .png, and .bmp.
Click Clicks on the object. (Inherited from IClickable)
Close Close a modal browser dialog, a tab of the browser, or the browser itself if it is the last tab (or IE6).
DismissAlert Dismisses a JavaScript alert.
DoubleClick Double-clicks a mouse button on the object. (Inherited from IClickable)
ExecuteJavaScript Evaluates JavaScript code within the top-level document context.
Exists Checks if any child object matching the locator exists for an object in the application under test. If the timeout parameter is passed the agent retries finding until the given timeout expires. If no timeout is specified and no object is found initially false is returned immediately. (Inherited from TestObject)
Exists Checks if an object exists in the application under test. (Inherited from TestObject)
Find Finds an object specified by an XPath locator. (Inherited from TestObject)
FindAll Finds all objects specified by an XPath locator. (Inherited from TestObject)
Forward Goes forward in the history.
GenerateLocator Returns a locator for this object. (Inherited from TestObject)
GetAlertText Retrieves the message text of a JavaScript alert.
GetBrowserMajorVersion Returns the browser's major version number.
GetChildren Returns the child objects of this object. (Inherited from TestObject)
GetDynamicMethodList Returns a list of methods (including their signature) that can be dynamically invoked on this TestObject. (Inherited from TestObject)
GetHtmlRect Retrieves the rectangle of the BrowserWindow in HTML pixels. The click function also uses HTML pixel coordinates for all DomElements. We recommend to use GetHtmlRect for all position calculations within the browser. This will ensure that your scripts are cross-browser capable and your position calculations are not affected by changing zoom levels on mobile browsers.
GetPageSource Returns the page source of the web site
GetParent Looks up the parent of this object in the test application. (Inherited from TestObject)
GetProperty Returns the value of the specified property. (Inherited from TestObject)
GetPropertyList Returns a list of property names that can be retrieved for the given object. (Inherited from TestObject)
GetRect Returns the size and position of this object. Per default the returned coordinates are relative to the parent window that contains this object. (Inherited from TestObject)
GetUrl Returns the URL for the main document.
GetUserAgent Returns the browser's user agent string
HighlightObject Highlights this object. (Inherited from TestObject)
ImageClick Clicks on the specified image asset. (Inherited from TestObject)
ImageClickFile Clicks on the specified image. (Inherited from TestObject)
ImageExists Returns whether the specified image asset exists. (Inherited from TestObject)
ImageExistsFile Returns whether the specified image exists. (Inherited from TestObject)
ImageRectangle Returns the object-relative rectangle of the specified image asset. (Inherited from TestObject)
ImageRectangleFile Returns the object-relative rectangle of the specified image. (Inherited from TestObject)
Invoke Dynamically invokes a method on the test object. (Inherited from TestObject)
InvokeMethods Dynamically invokes a sequence of methods starting at this TestObject. (Inherited from TestObject)
IsAlertPresent Returns true if a JavaScript alert is open
MouseMove Moves the pointer to the specified location in the object. This method is not supported for mobile Web applications. (Inherited from IClickable)
Navigate Navigates the main document to an URL.
PressKeys Presses (but does not release) a set of keys or mouse buttons. (Inherited from IKeyable)
PressMouse Presses (but does not release) a mouse button in the object. This method is not supported for mobile Web applications. (Inherited from IClickable)
ReleaseKeys Releases a set of keys or mouse buttons. (Inherited from IKeyable)
ReleaseMouse Releases a mouse button. This method is not supported for mobile Web applications. (Inherited from IClickable)
Reload Reloads the main document as the reload button in the browser does.
SetFocus Gives focus to the control. (Inherited from BrowserObject)
SetProperty Sets the value of the specified property. (Inherited from TestObject)
SetViewportName Set the size of the browser window to the specified size from your Browser Size list.
SetViewportSize Sets the size of the browser window to the specified width and height.
StartScreenRecording Starts screen recording (Inherited from TestObject)
StopScreenRecording Stops screen recording (Inherited from TestObject)
TextCapture Returns the text in this object's visible area. (Inherited from TestObject)
TextClick Clicks in the center of the specified text. (Inherited from TestObject)
TextExists Returns whether the specified text exists. (Inherited from TestObject)
TextRectangle Returns the object-relative rectangle of the specified text. (Inherited from TestObject)
TypeKeys Sends a set of keystrokes to the object. (Inherited from IKeyable)
TypePasswordKeys Types an encrypted password into an object, for example a text field. (Inherited from IKeyable)
Verify Executes a verification on the given asset in the context of this UI object. (Inherited from TestObject)
WaitForChildDisappearance Waits until the specified child object does not exist or until the timeout is reached. If you don't explicitly pass a timeout using the optional timeout parameter, the timeout specified by the option OPT_WAIT_RESOLVE_OBJDEF will be used. An exception is thrown if the timeout is reached. (Inherited from TestObject)
WaitForDisappearance Waits until the object does not exist or until the timeout is reached. If you don't explicitly pass a timeout using the optional timeout parameter, the timeout specified by the option OPT_WAIT_RESOLVE_OBJDEF will be used. An exception is thrown if the timeout is reached. (Inherited from TestObject)
WaitForObject Waits for an object that matches the specified locator. If no object matches within an timeout an ObjectNotFoundException is thrown. The default timeout is 5 seconds and you can change the timeout by setting the value of the option OPT_WAIT_RESOLVE_OBJDEF. Use WaitForObject if the AUT takes a long time to display a specific object, for example when a transaction is processed before showing any results. By default, an action in the UI does not require a WaitForObject, because of the built-in synchronization. If you receive random timeout errors during normal script execution, consider increasing the default timeout instead of adding WaitForObject statements to your scripts. (Inherited from TestObject)
WaitForProperty Waits until the specified property has the specified value or until the timeout is reached.If you don't explicitly pass a timeout using the optional timeout parameter, the timeout specified by the option OPT_WAIT_RESOLVE_OBJDEF will be used. An exception is thrown if the timeout is reached. (Inherited from TestObject)
WaitForPropertyNotEquals Waits until the specified property has a value that is different to the specified value or until the timeout is reached.If you don't explicitly pass a timeout using the optional timeout parameter, the timeout specified by the option OPT_WAIT_RESOLVE_OBJDEF will be used. An exception is thrown if the timeout is reached. (Inherited from TestObject)
WaitForScreenshotStable Waits until the control is visually stable and does not change its position, by comparing screenshots taken with the specified interval. If you don't explicitly pass a timeout using the optional timeout parameter, the timeout specified by the option OPT_WAIT_SCREENSHOT_STABLE will be used. The default interval is 200 milliseconds. An exception is thrown if the timeout is reached. (Inherited from TestObject)