Table of Contents

Class Util

Namespace
Ranorex.Core
Assembly
Ranorex.Core.dll

Provides common utility methods.

public class Util
Inheritance
Util
Inherited Members

Constructors

Util()

public Util()

Properties

IsRestartRequiredForWinAppAccess

Gets a value indicating whether a restart is required to access Windows apps.

public static bool IsRestartRequiredForWinAppAccess { get; }

Property Value

bool

Examples

The following code checks for the privileges to access Windows apps and restarts the executable in order to get those privileges:

if (Ranorex.Core.Util.IsRestartRequiredForWinAppAccess)
return Ranorex.Core.Util.RestartWithUiAccess();

Remarks

If this property returns true, the current process does not have the required privileges to access Windows apps. You can get the those privileges by calling the RestartWithUiAccess() method like in the example below.

Methods

GetApplicationOpenForms()

Gets the open forms of the application.

public static IList<Form> GetApplicationOpenForms()

Returns

IList<Form>

A list containing the open forms within the application.

Remarks

This method is a wrapper for the OpenForms property.

GetCodeModuleCSharpReplayTemplate()

Gets the CSharp code module replay template.

public static string GetCodeModuleCSharpReplayTemplate()

Returns

string

The CSharp code module replay template.

GetCodeModuleVBReplayTemplate()

Gets the VB.NET code module replay template.

public static string GetCodeModuleVBReplayTemplate()

Returns

string

The VB.NET code module replay template.

GetStaticAndDynamicCapabilities(Element)

Gets the static and dynamic capabilities of an element.

public static List<Capability> GetStaticAndDynamicCapabilities(Element element)

Parameters

element Element

An element.

Returns

List<Capability>

A List<T> containing all static and the dynamic capabilities of the element.

HasTopMostForm()

Determines whether the current application has a form with the TopMost property set to true.

public static bool HasTopMostForm()

Returns

bool

true if a form of this application has the TopMost property set to true; otherwise, false.

RestartWithUiAccess()

Restarts the current executable with UI access privileges. Those privileges are required to access Windows apps.

public static int RestartWithUiAccess()

Returns

int

The exit code returned by the current executable.

Examples

The following code checks for the privileges to access Windows apps and restarts the executable in order to get those privileges:

if (Ranorex.Core.Util.IsRestartRequiredForWinAppAccess)
return Ranorex.Core.Util.RestartWithUiAccess();

Remarks

If the current process does not have UI access privileges, you can call this method to restart the current executable with UI privileges. The executable will be restarted using the Ranorex.UiaLauncher which thereby provides the required privileges to e.g. access Windows apps.

StartRanorexInstrumentationWizard(string, IDictionary<string, string>)

Starts the ranorex instrumentation wizard.

public static bool StartRanorexInstrumentationWizard(string pageName, IDictionary<string, string> props)

Parameters

pageName string

Name of the page to show.

props IDictionary<string, string>

Additional properties passed to the wizard.

Returns

bool

A value indicating if the wizard could successfully be started.

StartRanorexInstrumentationWizard(string, IDictionary<string, string>, out Process)

Starts the ranorex instrumentation wizard.

public static bool StartRanorexInstrumentationWizard(string pageName, IDictionary<string, string> props, out Process process)

Parameters

pageName string

Name of the page to show.

props IDictionary<string, string>

Additional properties passed to the wizard.

process Process

Out parameter containing the created process

Returns

bool

A value indicating if the wizard could successfully be started.