Table of Contents

Interface IHost

Namespace
Ranorex.Core
Assembly
Ranorex.Core.dll

Represents a machine/device that provides UI elements that can be automated by Ranorex.

public interface IHost : IAdapter
Inherited Members

Methods

CloseApplication(Element, Duration)

Closes an application or web page which contains the specified element. If the application does not react to the close request within the specified grace period, the application process is killed.

bool CloseApplication(Element containedElement, Duration gracePeriod)

Parameters

containedElement Element

The element whose parent application to close.

gracePeriod Duration

A grace period before the process is killed (does not apply to mobile apps).

Returns

bool

Returns true if the application has closed within the grace period, otherwise false.

Remarks

Setting the grace period to zero causes the application's process not to be killed.

Exceptions

ArgumentOutOfRangeException

If gracePeriod is negative.

CloseApplication(int)

Closes an application with the specified process ID by trying to close its main window.

void CloseApplication(int processId)

Parameters

processId int

The process ID of the application to close.

Exceptions

ElementNotFoundException

If no application is found.

CloseApplication(int, Duration)

Closes an application with the specified process ID by trying to close its main window.

bool CloseApplication(int processId, Duration gracePeriod)

Parameters

processId int

The process ID of the application to close.

gracePeriod Duration

A grace period before the process is killed (does not apply to mobile apps).

Returns

bool

Returns true if the application has closed within the grace period, otherwise false.

Remarks

Setting the grace period to zero causes the application's process not to be killed.

Exceptions

ArgumentOutOfRangeException

If gracePeriod is negative.

GetDevToolsSession()

Get the devtools session.

IDevToolsSession GetDevToolsSession()

Returns

IDevToolsSession

KillApplication(Element)

Kills the process which contains the specified element.

void KillApplication(Element containedElement)

Parameters

containedElement Element

The element whose parent application to kill.

OpenBrowser(string, string)

Opens a web page in the specified browser.

int OpenBrowser(string url, string browserName)

Parameters

url string

The URL of the web page to open.

browserName string

The name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".

Returns

int

The process ID of the browser.

OpenBrowser(string, string, string, bool, bool, bool, bool, bool, bool)

Opens a web page in the specified browser.

int OpenBrowser(string url, string browserName, string browserArgs, bool killExisting, bool maximized, bool clearCache, bool incognitoMode, bool clearCookies, bool instrument)

Parameters

url string

The URL of the web page to open.

browserName string

The name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".

browserArgs string

Additional command line arguments to pass to the browser.

killExisting bool

Specifies whether any running browser instances should be closed first.

maximized bool

Specifies whether the started browser instances should be started maximized.

clearCache bool

Specifies whether cache should be cleared on browser start.

incognitoMode bool

Specifies whether the browser should start in incognito mode

clearCookies bool

Specifies whether cookies should be deleted on browser start.

instrument bool

Specifies whether the browser should be instrumented before browser start.

Returns

int

The process ID of the browser.

OpenBrowser(string, string, string, bool, bool, bool, bool, bool, bool, bool, bool)

Opens a web page in the specified browser.

int OpenBrowser(string url, string browserName, string browserArgs, bool killExisting, bool maximized, bool clearCache, bool clearCodeCache, bool clearServiceWorker, bool incognitoMode, bool clearCookies, bool instrument)

Parameters

url string

The URL of the web page to open.

browserName string

The name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".

browserArgs string

Additional command line arguments to pass to the browser.

killExisting bool

Specifies whether any running browser instances should be closed first.

maximized bool

Specifies whether the started browser instances should be started maximized.

clearCache bool

Specifies whether cache should be cleared on browser start.

clearCodeCache bool

Specifies whether code cache should be cleared on browser start.

clearServiceWorker bool

Specifies whether Service Worker folder should be cleared on browser start.

incognitoMode bool

Specifies whether the browser should start in incognito mode

clearCookies bool

Specifies whether cookies should be deleted on browser start.

instrument bool

Specifies whether the browser should be instrumented before browser start.

Returns

int

The process ID of the browser.