Class Host
- Namespace
- Ranorex
- Assembly
- Ranorex.Core.dll
Represents the host machine running Ranorex.
public class Host : Adapter, IHost, IAdapter
- Inheritance
-
Host
- Implements
- Inherited Members
Constructors
Host()
Creates a new Host adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!
protected Host()
Host(Element)
Creates a new Host adapter instance.
public Host(Element element)
Parameters
elementElementThe element to create the adapter for.
Exceptions
- NullReferenceException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
Properties
AvailableHosts
Get available hosts.
public static IEnumerable<string> AvailableHosts { get; }
Property Value
Remarks
The values returned represents all endpoints that can be set as the new element engine root. The first element in this collection will always be 'Localhost'. If there are other endpoints configured these will be appended at the end of the enumerable. The list is not sorted in any specific way. The endpoints returned by this property may change at any time.
Current
Gets the current host element. Use Ranore.Core.ElementEngine.Root to switch the current host. By default the current host is the local host.
public static IHost Current { get; }
Property Value
- IHost
The current host element.
CurrentHost
Gets the name of the current active host (automation root)
public static string CurrentHost { get; }
Property Value
- string
Display name of the currently active host
Remarks
If a remote host is active the display name of that remote host will be returned. By default 'localhost' will be returned.
this[string]
Gets the Form with the specified title, process name or process id.
public Form this[string appText] { get; }
Parameters
appTextstring
Property Value
- Form
The matching application form.
Local
Gets the local host element.
public static Host Local { get; }
Property Value
- Host
The local host element.
MachineName
The network name of the machine Ranorex is running on.
public virtual string MachineName { get; }
Property Value
OSEdition
The Windows edition of the machine running Ranorex.
public virtual string OSEdition { get; }
Property Value
OSVersion
The operating system version of the machine running Ranorex.
public virtual string OSVersion { get; }
Property Value
ProcessArchitecture
The bit width architecture used by the current process.
public virtual string ProcessArchitecture { get; }
Property Value
RanorexVersion
The version of the Ranorex Framework in use.
public virtual string RanorexVersion { get; }
Property Value
RemoteSession
True if the current user session is a remote session, i.e. operated via the remote desktop protocol.
public virtual bool RemoteSession { get; }
Property Value
RequiredCapabilities
Capabilities required by the adapter implementation.
protected override string[] RequiredCapabilities { get; }
Property Value
- string[]
RuntimeVersion
The version of the .NET Runtime currently running Ranorex.
public virtual string RuntimeVersion { get; }
Property Value
UserName
The login name of the user who is running Ranorex.
public virtual string UserName { get; }
Property Value
VirtualMachineManufacturer
The manufacturer of the virtual machine running the operating system.
public virtual string VirtualMachineManufacturer { get; }
Property Value
Methods
ActivateWindowsApp(string, string)
Activates the windows app with the specified app user model ID.
public void ActivateWindowsApp(string appId, string appFamilyName)
Parameters
Remarks
A timeout of one minute is used (see ActivateWindowsApp(string, string, Duration)).
ActivateWindowsApp(string, string, Duration)
Activates the windows app with the specified app user model ID.
public void ActivateWindowsApp(string appId, string appFamilyName, Duration timeout)
Parameters
appIdstringThe ID of the app.
appFamilyNamestringThe family name of the app.
timeoutDurationA timeout specifying how long the app launcher process needs to stay open after activation of the app (see remarks).
Remarks
To automate Windows apps a process needs to be elevated, however, Windows apps can only be activated from a non-elevated process. Therefore, This methods starts a new non-elevated process that activates the Windows app.
For some applications, the activation process needs to stay alive until the activated
app is fully loaded. The timeout argument determines how long the
activation process should stay alive after activating the Windows app.
ActivateWindowsApp(string, string, Duration, string)
Activates the windows app with the specified app user model ID and arguments.
public void ActivateWindowsApp(string appId, string appFamilyName, Duration timeout, string arguments)
Parameters
appIdstringThe ID of the app.
appFamilyNamestringThe family name of the app.
timeoutDurationA timeout specifying how long the app launcher process needs to stay open after activation of the app (see remarks).
argumentsstringArguments passed to the app on activation. Depending on the implementation of the app, these arguments may only be available when the app is currently not running.
Remarks
To automate Windows apps a process needs to be elevated, however, Windows apps can only be activated from a non-elevated process. Therefore, This methods starts a new non-elevated process that activates the Windows app.
For some applications, the activation process needs to stay alive until the activated
app is fully loaded. The timeout argument determines how long the
activation process should stay alive after activating the Windows app.
ActivateWindowsApp(string, string, string)
Activates the windows app with the specified app user model ID and arguments.
public void ActivateWindowsApp(string appId, string appFamilyName, string arguments)
Parameters
appIdstringThe ID of the app.
appFamilyNamestringThe family name of the app.
argumentsstringArguments passed to the app on activation. Depending on the implementation of the app, these arguments may only be available when the app is currently not running.
Remarks
To automate Windows apps a process needs to be elevated, however, Windows apps can only be activated from a non-elevated process. Therefore, This methods starts a new non-elevated process that activates the Windows app.
A timeout of one minute is used (see ActivateWindowsApp(string, string, Duration)).
ClearBrowserCache(string)
Clears the cache of the specified browser.
public void ClearBrowserCache(string browserName)
Parameters
browserNamestringThe name of the browser where the cache should be cleared. Can either be "firefox", "ie" or "chrome".
ClearBrowserCache(string, string)
Clears the cache of the specified browser.
public void ClearBrowserCache(string browserName, string userProfile)
Parameters
browserNamestringThe name of the browser where the cache should be cleared. Can either be "firefox", "ie" or "chrome".
userProfilestringUser profile to clear cache. Only supported for Firefox and Chrome.
ClearBrowserCookies(string)
Deletes all cookies from specified browser. Warning: Stored passwords or other important information will be deleted.
public void ClearBrowserCookies(string browserName)
Parameters
browserNamestringThe name of the browser where the cookies should be deleted. Can either be "firefox", "ie" or "chrome".
ClearBrowserCookies(string, string)
Deletes all cookies from specified browser. Warning: Stored passwords or other important information will be deleted.
public void ClearBrowserCookies(string browserName, string userProfile)
Parameters
browserNamestringThe name of the browser where the cookies should be deleted. Can either be "firefox", "ie" or "chrome".
userProfilestringUser profile to delete cookies. Only supported for Firefox and Chrome.
CloseApplication(Element)
Closes an application or web page which contains the specified element.
public void CloseApplication(Element containedElement)
Parameters
containedElementElementThe element whose parent application to close.
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.
public bool CloseApplication(Element containedElement, Duration gracePeriod)
Parameters
containedElementElementThe element whose parent application to close.
gracePeriodDurationA grace period before the process is killed (does not apply to mobile apps).
Returns
- bool
Returns
trueif the application has closed within the grace period, otherwisefalse.
Remarks
Setting the grace period to zero causes the application's process not to be killed.
Exceptions
- ArgumentOutOfRangeException
If
gracePeriodis negative.
CloseApplication(int)
Closes an application with the specified process ID by trying to close its main window.
public void CloseApplication(int processId)
Parameters
processIdintThe process ID of the application to close.
CloseApplication(int, Duration)
Closes an application with the specified process ID by trying to close its main window.
public bool CloseApplication(int processId, Duration gracePeriod)
Parameters
processIdintThe process ID of the application to close.
gracePeriodDurationA grace period before the process is killed (does not apply to mobile apps).
Returns
- bool
Returns
trueif the application has closed within the grace period, otherwisefalse.
Remarks
Setting the grace period to zero causes the application's process not to be killed.
Exceptions
- ArgumentOutOfRangeException
If
gracePeriodis negative.
CloseApplications(string)
Closes an application with a given process name.
public void CloseApplications(string processName)
Parameters
processNamestringThe process name of the application to close.
CloseBrowser(string)
Closes any open browser processes with the given name by sending a close message to its main window.
public bool CloseBrowser(string browserName)
Parameters
browserNamestringThe name of the browser to close. Can either be "firefox", "ie", "chrome" or "edge".
Returns
DeployIosApp(string, string, string)
Deploys an iOS app archive to the specified device.
public void DeployIosApp(string device, string archivePath, string appId)
Parameters
devicestringThe device name
archivePathstringPath to the app archive (*.ipa)
appIdstringThe application id e.g. (ranorex.RxBrowser)
FromElement(Element)
Converts an Element to an instance of this class.
public static Host FromElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- Host
The Host.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
FromPath(string)
Converts a string to an instance of this class by searching the root.
public static Host FromPath(string path)
Parameters
pathstringThe search path.
Returns
- Host
The Host.
Remarks
The DefaultSearchTimeout is used to search for the specified path.
Exceptions
- ArgumentNullException
If
pathisnull.- RxPathException
If the specified
pathis not valid.- ElementNotFoundException
If no element is found.
- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
GetApplicationForm(Process)
Gets the main Form of a process.
public Form GetApplicationForm(Process process)
Parameters
Returns
Remarks
If more Form instances are found for the process, the last Form found is returned (to avoid popups).
Exceptions
- ArgumentNullException
If
processisnull.- RanorexException
If getting the process Id from
processfails.- ElementNotFoundException
If no Form belonging to the specified process is found within the DefaultSearchTimeout.
GetApplicationForm(Process, Duration)
Gets the main Form of a process.
public Form GetApplicationForm(Process process, Duration timeout)
Parameters
processProcessThe process to get the main Form from.
timeoutDurationThe time to keep searching for a Form instance belonging to the
process.
Returns
Remarks
If more Form instances are found for the process, the last Form found is returned (to avoid popups).
Exceptions
- ArgumentNullException
If
processisnull.- RanorexException
If getting the process Id from
processfails.- ElementNotFoundException
If no Form belonging to the specified process is found within the
timeout.
GetApplicationForm(int, Duration)
Gets the main Form of a process.
public Form GetApplicationForm(int processId, Duration timeout)
Parameters
processIdintThe ID of the process to get the main Form from.
timeoutDurationThe time to keep searching for a Form instance belonging to the process.
Returns
Remarks
If more Form instances are found for the process ID, the last Form found is returned (to avoid popups).
Exceptions
- ElementNotFoundException
If no Form belonging to the specified process ID is found within the
timeout.
GetDevToolsSession()
Gets devtools session.
public IDevToolsSession GetDevToolsSession()
Returns
InstrumentAndDeployAndroidApp(string, string, bool, DeploymentModes, Duration)
Can be invoked to instrument/deploy an Android app to a configured device.
public void InstrumentAndDeployAndroidApp(string deviceName, string sourceApkFilePath, bool instrument, Host.DeploymentModes deployMode, Duration timeout)
Parameters
deviceNamestringThe display name of the device on that the app shall be deployed
sourceApkFilePathstringFile path to the android application that shall be instrumented/deployed (*.apk)
instrumentboolIf set to true Ranorex will instrument the application prior to deployment. If set to false Ranorex assumes the APK file is instrumented already. The application will simply be deployed to the device. If this parameter is set to false but the *.apk file you try to deploy is not instrumented Ranorex will not be able to communicate with the device correctly.
deployModeHost.DeploymentModesStates how the deployment shall be done. Possible modes are NoDeploy, WiFi and USB. If NoDeploy is passed no deployment will be done (just instrument the APK file). The instrumented file then can be found in [Drive]:\Users[UserName]\Documents\Ranorex\InstrumentedApk[APKName]-instrumented.apk. When WiFi is selected the apk file will be deployed over your wireless network (RanorexService needs to be installed). When USB is selected the app will be deployed over USB cable to your connected device (deployment can be done without installed device service; but for automation the service is still required!). When Auto is selected the app will be deployed using the mode that was used to add the device.
timeoutDurationAfter the specified timeout the operation aborts (timeout can happen when no connection can be established, instrumentation fails...). Depending on the size of your app, instrumentation and deployment can take quite some time. Instrumentation and deployment on low spec PCs can take up to about 10 minutes.
InstrumentAndDeployAndroidApp(string, string, bool, DeploymentModes, Duration, InstrumentApkOptions)
Can be invoked to instrument/deploy an Android app to a configured device.
public void InstrumentAndDeployAndroidApp(string deviceName, string sourceApkFilePath, bool instrument, Host.DeploymentModes deployMode, Duration timeout, InstrumentApkOptions options)
Parameters
deviceNamestringThe display name of the device on that the app shall be deployed
sourceApkFilePathstringFile path to the android application that shall be instrumented/deployed (*.apk)
instrumentboolIf set to true Ranorex will instrument the application prior to deployment. If set to false Ranorex assumes the APK file is instrumented already. The application will simply be deployed to the device. If this parameter is set to false but the *.apk file you try to deploy is not instrumented Ranorex will not be able to communicate with the device correctly.
deployModeHost.DeploymentModesStates how the deployment shall be done. Possible modes are NoDeploy, WiFi and USB. If NoDeploy is passed no deployment will be done (just instrument the APK file). The instrumented file then can be found in [Drive]:\Users[UserName]\Documents\Ranorex\InstrumentedApk[APKName]-instrumented.apk. When WiFi is selected the apk file will be deployed over your wireless network (RanorexService needs to be installed). When Usb is selected the app will be deployed over USB cable to your connected device (deployment can be done without installed device service; but for automation the service is still required!). When Auto is selected the app will be deployed using the mode that was used to add the device.
timeoutDurationSpecifies the timeout for each operation in the instrument and deploy process. After the specified timeout the operation aborts (timeout can happen when no connection can be established, instrumentation fails...). Depending on the size of your app, instrumentation and deployment can take quite some time. Instrumentation and deployment on low spec PCs can take up to about 10 minutes.
optionsInstrumentApkOptionsAdvanced instrumentation options. Ranorex.Core.Remoting.RecordItems.InstrumentApkOptions for more information what the specific options are.
Exceptions
- NullReferenceException
Will be throw if
optionsis null.
InstrumentAndDeployAndroidApp(string, string, bool, DeploymentModes, Duration, bool, bool)
Can be invoked to instrument/deploy an Android app to a configured device.
public void InstrumentAndDeployAndroidApp(string deviceName, string sourceApkFilePath, bool instrument, Host.DeploymentModes deployMode, Duration timeout, bool treeSimplification, bool fullImageComparison)
Parameters
deviceNamestringThe display name of the device on that the app shall be deployed
sourceApkFilePathstringFile path to the android application that shall be instrumented/deployed (*.apk)
instrumentboolIf set to true Ranorex will instrument the application prior to deployment. If set to false Ranorex assumes the APK file is instrumented already. The application will simply be deployed to the device. If this parameter is set to false but the *.apk file you try to deploy is not instrumented Ranorex will not be able to communicate with the device correctly.
deployModeHost.DeploymentModesStates how the deployment shall be done. Possible modes are NoDeploy, WiFi and USB. If NoDeploy is passed no deployment will be done (just instrument the APK file). The instrumented file then can be found in [Drive]:\Users[UserName]\Documents\Ranorex\InstrumentedApk[APKName]-instrumented.apk. When WiFi is selected the apk file will be deployed over your wireless network (RanorexService needs to be installed). When Usb is selected the app will be deployed over USB cable to your connected device (deployment can be done without installed device service; but for automation the service is still required!). When Auto is selected the app will be deployed using the mode that was used to add the device.
timeoutDurationAfter the specified timeout the operation aborts (timeout can happen when no connection can be established, instrumentation fails...). Depending on the size of your app, instrumentation and deployment can take quite some time. Instrumentation and deployment on low spec PCs can take up to about 10 minutes.
treeSimplificationboolWhen set to false no post processing of the UI-Tree takes place. This results in a larger UI-Tree which could be useful for automating 3rd party Android controls. (See: https://www.ranorex.com/help/latest/android-testing#AndroidTesting-FICandtreesimplification)
fullImageComparisonboolWhen set to true more robust image comparison is used to determine resource id's for images. This option decreases startup performance. (See: https://www.ranorex.com/help/latest/android-testing#AndroidTesting-FICandtreesimplification)
InstrumentAndDeployIosApp(string, string, string, InstrumentIpaOptions)
Instrument and deploy an iOS app.
public void InstrumentAndDeployIosApp(string device, string archivePath, string appId, InstrumentIpaOptions options)
Parameters
devicestringThe device name
archivePathstringPath to the app archive (*.ipa)
appIdstringThe application id e.g. (ranorex.RxBrowser)
optionsInstrumentIpaOptionsAdvanced instrumentation options. InstrumentIpaOptions for more information what the specific options are.
KillApplication(Element)
Kills the process which contains the specified element.
public void KillApplication(Element containedElement)
Parameters
containedElementElementThe element whose parent application to kill.
KillApplication(int)
Kills a process which the specified process ID.
public void KillApplication(int processId)
Parameters
processIdintThe ID of the process to kill.
KillApplications(string)
Kills all applications with the specified process name.
public void KillApplications(string processName)
Parameters
processNamestringThe process name of the applications to kill.
KillBrowser(string)
Kills any open browser processes with the given name.
public void KillBrowser(string browserName)
Parameters
browserNamestringThe name of the browser to close. Can either be "firefox", "ie", "chrome" or "edge".
MakeCurrentHost(string)
Activates the given host that will then be used as the new host.
public static void MakeCurrentHost(string host)
Parameters
hoststringThe host to activate. Null or whitespace only string will reset the current host to 'Localhost'.
Remarks
The current host will produce the root flavor element. Use AvailableHosts to to get a list of all available hosts.
OpenBrowser(string)
Opens a web page in the default browser.
public int OpenBrowser(string url)
Parameters
urlstringThe URL of the web page to open.
Returns
- int
The process ID of the browser.
OpenBrowser(string, string)
Opens a web page in the specified browser.
public int OpenBrowser(string url, string browserName)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe 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, bool)
Opens a web page in the specified browser.
public int OpenBrowser(string url, string browserName, bool killExisting)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie" or "chrome".
killExistingboolSpecifies whether any running browser instances should be closed first.
Returns
- int
The process ID of the browser.
OpenBrowser(string, string, bool, bool)
Opens a web page in the specified browser.
public int OpenBrowser(string url, string browserName, bool killExisting, bool maximized)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".
killExistingboolSpecifies whether any running browser instances should be closed first.
maximizedboolSpecifies whether the started browser instances should be started maximized.
Returns
- int
The process ID of the browser.
OpenBrowser(string, string, string, bool, bool)
Opens a web page in the specified browser.
public int OpenBrowser(string url, string browserName, string browserArgs, bool killExisting, bool maximized)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".
browserArgsstringAdditional command line arguments to pass to the browser.
killExistingboolSpecifies whether any running browser instances should be closed first.
maximizedboolSpecifies whether the started browser instances should be started maximized.
Returns
- int
The process ID of the browser.
OpenBrowser(string, string, string, bool, bool, bool, bool, bool)
Opens a web page in the specified browser.
public int OpenBrowser(string url, string browserName, string browserArgs, bool killExisting, bool maximized, bool clearCache, bool incognitoMode, bool clearCookies)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".
browserArgsstringAdditional command line arguments to pass to the browser.
killExistingboolSpecifies whether any running browser instances should be closed first.
maximizedboolSpecifies whether the started browser instances should be started maximized.
clearCacheboolSpecifies whether cache should be cleared on browser start.
incognitoModeboolSpecifies whether the browser should start in incognito mode
clearCookiesboolSpecifies whether cookies should be deleted on browser start.
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.
public int OpenBrowser(string url, string browserName, string browserArgs, bool killExisting, bool maximized, bool clearCache, bool incognitoMode, bool clearCookies, bool instrument)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium", "edge" or "edgechromium".
browserArgsstringAdditional command line arguments to pass to the browser.
killExistingboolSpecifies whether any running browser instances should be closed first.
maximizedboolSpecifies whether the started browser instances should be started maximized.
clearCacheboolSpecifies whether cache should be cleared on browser start.
incognitoModeboolSpecifies whether the browser should start in incognito mode
clearCookiesboolSpecifies whether cookies should be deleted on browser start.
instrumentboolSpecifies 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)
Opens a web page in the specified browser.
public int OpenBrowser(string url, string browserName, string browserArgs, bool killExisting, bool maximized, bool clearCache, bool clearCodeCache, bool clearServiceWorker, bool incognitoMode, bool clearCookies)
Parameters
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium" or "edge".
browserArgsstringAdditional command line arguments to pass to the browser.
killExistingboolSpecifies whether any running browser instances should be closed first.
maximizedboolSpecifies whether the started browser instances should be started maximized.
clearCacheboolSpecifies whether cache should be cleared on browser start.
clearCodeCacheboolSpecifies whether code cache should be cleared on browser start.
clearServiceWorkerboolSpecifies whether Service Worker folder should be cleared on browser start.
incognitoModeboolSpecifies whether the browser should start in incognito mode
clearCookiesboolSpecifies whether cookies should be deleted on 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.
public 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
urlstringThe URL of the web page to open.
browserNamestringThe name of the browser to open. Can either be "firefox", "ie", "chrome", "chromium", "edge" or "edgechromium".
browserArgsstringAdditional command line arguments to pass to the browser.
killExistingboolSpecifies whether any running browser instances should be closed first.
maximizedboolSpecifies whether the started browser instances should be started maximized.
clearCacheboolSpecifies whether cache should be cleared on browser start.
clearCodeCacheboolSpecifies whether code cache should be cleared on browser start.
clearServiceWorkerboolSpecifies whether Service Worker folder should be cleared on browser start.
incognitoModeboolSpecifies whether the browser should start in incognito mode
clearCookiesboolSpecifies whether cookies should be deleted on browser start.
instrumentboolSpecifies whether the browser should be instrumented before browser start.
Returns
- int
The process ID of the browser.
RunApplication(string)
Runs an application with the specified filename.
public int RunApplication(string fileName)
Parameters
fileNamestringThe file name of the application to run.
Returns
- int
The process ID of the started application.
Remarks
Using an AppUserModelId (familyName!appName) instead of a file name activates a Windows 8 App instead.
Exceptions
- RanorexException
Thrown if the application cannot be started.
RunApplication(string, string)
Runs an application with the specified filename, passing the specified arguments.
public int RunApplication(string fileName, string arguments)
Parameters
fileNamestringThe name of the application to run.
argumentsstringThe arguments to pass to the application on startup.
Returns
- int
The process ID of the started application.
Remarks
Using an AppUserModelId (familyName!appName) instead of a file name activates a Windows 8 App instead.
Exceptions
- RanorexException
Thrown if the application cannot be started.
RunApplication(string, string, string)
Runs an application with the specified filename, passing the specified arguments and setting the specified working directory.
public int RunApplication(string fileName, string arguments, string workingDirectory)
Parameters
fileNamestringThe name of the application to run.
argumentsstringThe arguments to pass to the application on startup.
workingDirectorystringThe working directory to use for the started application.
Returns
- int
The process ID of the started application.
Remarks
Using an AppUserModelId (familyName!appName) instead of a file name activates a Windows 8 App instead.
Exceptions
- RanorexException
Thrown if the application cannot be started.
RunApplication(string, string, string, bool)
Runs an application with the specified filename, passing the specified arguments and setting the specified working directory.
public int RunApplication(string fileName, string arguments, string workingDirectory, bool maximized)
Parameters
fileNamestringThe name of the application to run.
argumentsstringThe arguments to pass to the application on startup.
workingDirectorystringThe working directory to use for the started application.
maximizedboolSpecifies whether the application should be started with a normal or maximized main window.
Returns
- int
The process ID of the started application.
Remarks
Using an AppUserModelId (familyName!appName) instead of a file name activates a Windows 8 App instead.
Exceptions
- RanorexException
Thrown if the application cannot be started.
RunApplication(string, string, string, bool, RunAppFlags)
Runs an application with the specified filename, passing the specified arguments and setting the specified working directory.
public int RunApplication(string fileName, string arguments, string workingDirectory, bool maximized, RunAppFlags runFlags)
Parameters
fileNamestringThe name of the application to run.
argumentsstringThe arguments to pass to the application on startup.
workingDirectorystringThe working directory to use for the started application.
maximizedboolSpecifies whether the application should be started with a normal or maximized main window.
runFlagsRunAppFlagsSpecifies special startup behavior to use when running an application.
Returns
- int
The process ID of the started application.
Remarks
Using an AppUserModelId (familyName!appName) instead of a file name activates a Windows 8 App instead.
Exceptions
- RanorexException
Thrown if the application cannot be started.
RunMobileApp(string, string)
Starts an app on a mobile device. This operation only works for devices that were configured trough the Ranorex user interface. This operation also works when the app is running on the device already. In that case the running app will be closed and started again to reset it into the initial state. Only apps that were instrumented by the Ranorex system can be started by Ranorex.
public void RunMobileApp(string deviceDisplayName, string appName)
Parameters
deviceDisplayNamestringThe name you configured for your device. If no device with that name exists or is not connected (that means Ranorex isn't able to communicate with the corresponding device) the operation will fail.
appNamestringThe app that shall be started. This has to be the unique application identifier. E.g. for android devices such an app identifier looks like 'ranorex.android.DemoGui'.
Exceptions
- ArgumentException
If deviceDisplayName or appName is null or empty.
RunMobileApp(string, string, bool)
Starts an app on a mobile device. This operation only works for devices that were configured trough the Ranorex user interface. This operation also works when the app is running on the device already. In that case the running app will either be closed and started again to reset it into the initial state or only brought to the foreground depending on the 'resetInitialState' parameter. Only apps that were instrumented by the Ranorex system can be started by Ranorex.
public void RunMobileApp(string deviceDisplayName, string appName, bool resetInitialState)
Parameters
deviceDisplayNamestringThe name you configured for your device. If no device with that name exists or is not connected (that means Ranorex isn't able to communicate with the corresponding device) the operation will fail.
appNamestringThe app that shall be started. This has to be the unique application identifier. E.g. for android devices such an app identifier looks like 'ranorex.android.DemoGui'.
resetInitialStateboolIndicates if the app should be restarted on launch or just brought to the foreground in case the app is already running.
Exceptions
- ArgumentException
If deviceDisplayName or appName is null or empty.
RunMobileApp(string, string, bool, string)
Starts an app on a mobile device. This operation only works for devices that were configured trough the Ranorex user interface. This operation also works when the app is running on the device already. In that case the running app will either be closed and started again to reset it into the initial state or only brought to the foreground depending on the 'resetInitialState' parameter. Only apps that were instrumented by the Ranorex system can be started by Ranorex.
public void RunMobileApp(string deviceDisplayName, string appName, bool resetInitialState, string url)
Parameters
deviceDisplayNamestringThe name you configured for your device. If no device with that name exists or is not connected (that means Ranorex isn't able to communicate with the corresponding device) the operation will fail.
appNamestringThe app that shall be started. This has to be the unique application identifier. E.g. for android devices such an app identifier looks like 'ranorex.android.DemoGui'.
resetInitialStateboolIndicates if the app should be restarted on launch or just brought to the foreground in case the app is already running.
urlstringThe url the RxServiceApp should open a browser.
Exceptions
- ArgumentException
If deviceDisplayName or appName is null or empty.
Operators
implicit operator Host(Element)
Implicitly converts an Element to an instance of this class.
public static implicit operator Host(Element element)
Parameters
elementElementThe element to convert.
Returns
- Host
The Host.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
implicit operator Host(string)
Implicitly converts a string to an instance of this class by searching the root.
public static implicit operator Host(string path)
Parameters
pathstringThe search path.
Returns
- Host
The Host.
Remarks
The DefaultSearchTimeout is used to search for the specified path.
Exceptions
- ArgumentNullException
If
pathisnull.- RxPathException
If the specified
pathis not valid.- ElementNotFoundException
If no element is found.
- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.