Class Application
Application object that contains the fluent methods to create your Application workflow.
Instantiated using GPAL.Application
Inheritance
Implements
Inherited Members
Namespace: GenerallyPositive.Application
Assembly: GPAL.dll
Syntax
public class Application : IAllowAllActionAndAnySelector, IAllowAllApplicationAndAllSelector, IAllowSelectorActionOrAnySelector, IAllowWaitForWindow, IAllowAfterWaitForAndSizeControl, IAllowPersistence, IAllowWithPersistentSelector, IAllowPersistentCallBack, IAllowAfterAnySelectorExceptWithAll, IAllowAllExceptParameters, IAllowApplicationAction, IAllowClose, IAllowTabActions, IAllowAnySelector, IAllowWithSelector, IAllowAfterAnySelector, IAllowSelectorAction, IAllowClicks, IAllowFillInFrom, IAllowFocus, IAllowHover, IAllowMoveTo, IAllowScrolling, IAllowWaitFor, IAllowKeyboardActions, IAllowToGPALObject<Application>, IAllowCallBack, IAllowWithAllThatMatch, IAllowSizeControl, IAllowApplicationOpenOrParameters, IAllowApplicationSettingsOrOpen, IAllowApplicationOpen, IAllowApplicationSettings
Examples
Selector gpalTeamSelector = (Selector)GPAL.Selector
.WithXPath("/Pane/Document/Group[3]/Group/Tree/ListItem[1]/TreeItem[4]/Hyperlink");
GPAL.Application
.Open(@"C:\Users\CurrentUser\AppData\Local\Microsoft\Teams\current\teams.exe")
.WithSelector(gpalTeamSelector)
.LeftClick();
Properties
ApplicationPath
The path of the program you Opened.
This get is intended for debugging only.
Declaration
public string ApplicationPath { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The path you supplied. |
Maximize
Maximize the application to full-screen
Declaration
public IAllowAllApplicationAndAllSelector Maximize { get; }
Property Value
| Type | Description |
|---|---|
| IAllowAllApplicationAndAllSelector |
Minimize
Minimize the application to the taskbar
Declaration
public IAllowAllApplicationAndAllSelector Minimize { get; }
Property Value
| Type | Description |
|---|---|
| IAllowAllApplicationAndAllSelector |
Name
A name you provide to be used when publishing events.
Use .WithName to provide your own friendly name. If not supplied GPAL will assign the name application1, application2, etc
This get is intended for debugging only.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The name you supplied. |
Process
The current Windows process for the program run via Open.
Only one program can be Opened/controlled per application.
This get is intended for debugging only.
Declaration
public Process Process { get; }
Property Value
| Type | Description |
|---|---|
| System.Diagnostics.Process | The Windows Process |
Restore
Restore the application to 'original' size, unminimize
Declaration
public IAllowAllApplicationAndAllSelector Restore { get; }
Property Value
| Type | Description |
|---|---|
| IAllowAllApplicationAndAllSelector |
Methods
AppendFrom(GPALDatabase)
Append the data from the database to the end of the input Selectors defined in the UOW
One token (one column in the current row) per per input.
If .WithAllThatMatch is defined on the current UOW, then the token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector AppendFrom(GPALDatabase inputDatabase)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALDatabase | inputDatabase | The GPAL Database definitoin |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
AppendFrom(IGPALFile)
Append the data from the input file to the end of the input Selectors defined in the UOW
One token (one string [between commas] from the current row) per per input.
If .WithAllThatMatch is defined on the current UOW, then the token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector AppendFrom(IGPALFile inputFile)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALFile | inputFile | The GPAL File definition |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
AppendFrom(IGPALGrid<String>)
Append the data from the input grid to the end of the input Selectors defined in the UOW
One token (one string from the current row) per per input.
If .WithAllThatMatch is defined on the current UOW, then this token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector AppendFrom(IGPALGrid<string> inputGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALGrid<System.String> | inputGrid | The input grid of tokens |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
AppendFrom(String)
Append the given text to the first input in the UOW. Should probably only be used with one selector at a time.
If .WithAllThatMatch is defined on the current UOW, then this text is entered into {num} inputs that matches the Selector(s) in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector AppendFrom(string textToUse)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | textToUse | The input text to use |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
CallAfterFillIn(Application.CallAfterFillInDelegate)
Add a handler to call after a row of tokens is consumed and after all inputs are filled in with data.
Only one CallAfterFillIn handler is possible, no chaining.
Use FillInFrom[Database|File|GPALGrid] to loop thru data in your main workflow and then perform next workflow steps in the CallAfterFillIn handler.
Declaration
public IAllowAfterAnySelector CallAfterFillIn(Application.CallAfterFillInDelegate callAfterFillIn)
Parameters
| Type | Name | Description |
|---|---|---|
| Application.CallAfterFillInDelegate | callAfterFillIn | Your CallAfterFillIn method |
Returns
| Type | Description |
|---|---|
| IAllowAfterAnySelector | -1 to terminate the program, otherwise the value is ignored. |
CallIfFound(Application.CallIfDelegate)
Add a Unit of Work level CallIfFound handler to be called if any defined selectors find/match elements.
This method will be called for every found selector in the current UOW.
CallIf handlers can remove themselves by calling myApplication.RemoveCallIfHandlerEverywhere(handler)
Selectors may remove themselves from a UOW by using selector.Remove()
More than one callback may be defined and will cascade thru the list depending upon the callback return value.
See: CallIfDelegate
Declaration
public IAllowAfterAnySelector CallIfFound(Application.CallIfDelegate callIfFoundDelegate)
Parameters
| Type | Name | Description |
|---|---|---|
| Application.CallIfDelegate | callIfFoundDelegate | Callback delegate |
Returns
| Type | Description |
|---|---|
| IAllowAfterAnySelector | Fluent interface to write your workflow |
CallIfNotFound(Application.CallIfDelegate)
Add a Unit of Work level CallIfNotFound handler to be called if any defined selectors DO NOT find/match elements.
This method will be called for every NOT FOUND selector in the current UOW.
CallIf handlers can remove themselve by calling myApplication.RemoveCallIfHandlerEverywhere(handler)
Selectors may remove themselves from a UOW by using selector.Remove()
More than one callback may be defined and will cascade thru the list depending upon the callback return value.
See: CallIfDelegate
Declaration
public IAllowAfterAnySelector CallIfNotFound(Application.CallIfDelegate callIfNotFoundDelegate)
Parameters
| Type | Name | Description |
|---|---|---|
| Application.CallIfDelegate | callIfNotFoundDelegate | Callback delegate |
Returns
| Type | Description |
|---|---|
| IAllowAfterAnySelector | Fluent interface to write your workflow |
Close()
Close/terminate the application.
This terminates the fluent interface and nothing can be chained to this command.
Declaration
public void Close()
FillInFrom(GPALDatabase)
FillIn data from the database overwriting text in the input Selector(s) defined in the UOW
One token (one column in the current row) per input/element found.
If .WithAllThatMatch is defined on the current UOW, then the token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector FillInFrom(GPALDatabase inputDatabase)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALDatabase | inputDatabase | The GPAL Database definitoin |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
FillInFrom(IGPALFile)
FillIn data from the file overwriting text in the input Selector(s) defined in the UOW
One token (one string [between commas] from the current row) per input/element found.
If .WithAllThatMatch is defined on the current UOW, then the token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector FillInFrom(IGPALFile inputFile)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALFile | inputFile | The GPAL File definition |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
FillInFrom(IGPALGrid<String>)
FillIn data from the grid overwriting text in the input Selector(s) defined in the UOW
One token (one string from the current row) per input/element found.
If .WithAllThatMatch is defined on the current UOW, then this token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector FillInFrom(IGPALGrid<string> inputGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALGrid<System.String> | inputGrid | The input grid of tokens |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
FillInFrom(String)
FillIn the text from the string overwriting text in the first input in the UOW. Should probably only be used with one selector at a time.
If .WithAllThatMatch is defined on the current UOW, then this text is entered into {num} inputs that matches the Selector(s) in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector FillInFrom(string textToUse)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | textToUse | The input text to use |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
Focus()
Focus the current element found via the Selector. Only the first element per Selector found will be focused.
IF using hardwre emulation (.WithHardware) for this selector, for text inputs, focus is a click in the control. Otherwise, hardware emulation hovers the mouse over the control.
If .WithAllThatMatch is defined on the current UOW, then focus will interate over every {num} elements that matches the Selector(s) in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector Focus()
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
Hover()
Hover the mouse over the current element found via the Selector. Only the first element per Selector found will be focused.
Using UIAutomation, setFocus is first called on the item, then the mouse moved to hover over the element.
IF using hardwre emulation (.WithHardware) for this selector, for text inputs, focus is a click in the control. Otherwise, hardware emulation hovers the mouse over the control.
If .WithAllThatMatch is defined on the current UOW, then focus will interate over every {num} elements that matches the Selector(s) in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector Hover()
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
InsertFrom(GPALDatabase)
Insert the text from the database at the beginning of the input Selector(s) defined in the UOW
One token (one column in the current row) per input/element found.
If .WithAllThatMatch is defined on the current UOW, then the token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector InsertFrom(GPALDatabase inputDatabase)
Parameters
| Type | Name | Description |
|---|---|---|
| GPALDatabase | inputDatabase | The GPAL Database definitoin |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
InsertFrom(IGPALFile)
Insert the data from the file at the beginning of the text in the input Selector(s) defined in the UOW
One token (one string [between commas] from the current row) per per input/element found.
If .WithAllThatMatch is defined on the current UOW, then the token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector InsertFrom(IGPALFile inputFile)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALFile | inputFile | The GPAL File definition |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
InsertFrom(IGPALGrid<String>)
Insert the data from the grid at the beginning of the text in the input Selector(s) defined in the UOW
One token (one string from the current row) per input/element found.
If .WithAllThatMatch is defined on the current UOW, then this token is entered into {num} inputs that matches the corresponding Selector in the current UOW.
If CallAfterFillIn callback is defined, it will be called after each row is consumed and the text is input.
Declaration
public IAllowSelectorActionOrAnySelector InsertFrom(IGPALGrid<string> inputGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| IGPALGrid<System.String> | inputGrid | The input grid of tokens |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
InsertFrom(String)
Insert the text from the string at the beginning of the first input in the UOW. Should probably only be used with one selector at a time.
Example: If three inputs are defined and three 'InsertFrom' are defined, then the text is assigned to the same ordinal input element found via the Selector(s)
If .WithAllThatMatch is defined on the current UOW, then this text is entered into {num} inputs that matches the corresponding Selector(s) in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector InsertFrom(string textToUse)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | textToUse | The input text to use |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
LeftClick(Enums.ModifierKeys)
Left click the element found for Selector(s) defined in the UOW
One left click for the first element found for each selector. Should probably be used with only one Selector in the UOW.
If .WithAllThatMatch is defined on the current UOW, then a left click is performed on {num} elements that matches the corresponding Selector in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector LeftClick(Enums.ModifierKeys modifierKeys = Enums.ModifierKeys.None)
Parameters
| Type | Name | Description |
|---|---|---|
| Enums.ModifierKeys | modifierKeys |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
LeftDoubleClick()
Left double click the element found for Selector(s) defined in the UOW
One left double click for the first element found for each selector. Should probably be used with only one Selector in the UOW.
If .WithAllThatMatch is defined on the current UOW, then a left click is performed on {num} elements that matches the corresponding Selector in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector LeftDoubleClick()
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
MoveTo()
Move the mouse to the current element found via the Selector. Only the first element per Selector found will be 'moved to'.
IF using hardwre emulation (.WithHardware) for this selector, the mouse is moved to hover over the control.
If .WithAllThatMatch is defined on the current UOW, then MoveTo will move the mouse over every {num} elements that matches the Selector(s) in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector MoveTo()
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
Open(String)
Launch the application specified in the path.
Find the root automation element and place into applicationSettings.RootAutomationElement
Used in conjunction with .WithParameters
Declaration
public IAllowAllExceptParameters Open(string applicationPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationPath | Path to application to open/run/launch |
Returns
| Type | Description |
|---|---|
| IAllowAllExceptParameters | Fluent interface to write your workflow |
PersistentCallIfFound(Application.CallIfDelegate)
Add a persistent CallIfFound handler to be called if any defined persistent selectors find/match elements.
Persistent selectors are always looked for before every action cross-cutting your workflow.
Persistent handlers can remove themselves in the CallIfHandler by calling myApplication.RemoveCallIfHandlerEverywhere(handler)
More than one callback may be defined and will cascade thru the list depending upon the callback return value.
See: CallIfDelegate
Declaration
public IAllowPersistentCallBack PersistentCallIfFound(Application.CallIfDelegate persistentCallIfFound)
Parameters
| Type | Name | Description |
|---|---|---|
| Application.CallIfDelegate | persistentCallIfFound |
Returns
| Type | Description |
|---|---|
| IAllowPersistentCallBack | Fluent interface to write your workflow |
PersistentCallIfNotFound(Application.CallIfDelegate)
Add a persistent CallIfNotFound handler to be called if any defined persistent selectors DO NOT find/match elements.
Persistent selectors are always looked for before every action cross-cutting your workflow.
Persistent handlers can remove themselves in the CallIfHandler by calling myApplication.RemoveCallIfHandlerEverywhere(handler)
More than one callback may be defined and will cascade thru the list depending upon the callback return value.
See: CallIfDelegate
Declaration
public IAllowPersistentCallBack PersistentCallIfNotFound(Application.CallIfDelegate persistentCallIfNotFound)
Parameters
| Type | Name | Description |
|---|---|---|
| Application.CallIfDelegate | persistentCallIfNotFound |
Returns
| Type | Description |
|---|---|
| IAllowPersistentCallBack | Fluent interface to write your workflow |
RemoveCallIfHandlerEverywhere(Application.CallIfDelegate)
Helper method for GPAL applications to remove a handler from all UOWs. Envisioned to be used in a persistent handler, but can be used anyway imagined. This is not fluent.
Declaration
public void RemoveCallIfHandlerEverywhere(Application.CallIfDelegate func)
Parameters
| Type | Name | Description |
|---|---|---|
| Application.CallIfDelegate | func | The CallIf handler to remove |
RightClick()
Right click the element found for Selector(s) defined in the UOW
One right click for the first element found for each selector. Should probably be used with only one Selector in the UOW.
If .WithAllThatMatch is defined on the current UOW, then a right click is performed on {num} elements that matches the corresponding Selector in the current UOW.
Declaration
public IAllowSelectorActionOrAnySelector RightClick()
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
ScrollHorizontalLarge(Int32)
Scroll the element horizontally in a large increment.
https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-scrollamount
Declaration
public IAllowSelectorActionOrAnySelector ScrollHorizontalLarge(int iterations = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iterations | Negative iterations scroll left. |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
ScrollHorizontalPercent(Int32)
Element's horizontal scroll position as a percentage of the total content area within the AutomationElement.
Declaration
public IAllowSelectorActionOrAnySelector ScrollHorizontalPercent(int percent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | percent | Percentage of the total content area [0-100] |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
ScrollHorizontalSmall(Int32)
Scroll the element horizontally in a small increment.
https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-scrollamount
Declaration
public IAllowSelectorActionOrAnySelector ScrollHorizontalSmall(int iterations = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iterations | Negative iterations scroll left. |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
ScrollVerticalLarge(Int32)
Scroll the element vertically in a large increment.
https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-scrollamount
Declaration
public IAllowSelectorActionOrAnySelector ScrollVerticalLarge(int iterations = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iterations | Negative iterations scroll up. |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
ScrollVerticalPercent(Int32)
Element's vertical scroll position as a percentage of the total content area within the AutomationElement.
Declaration
public IAllowSelectorActionOrAnySelector ScrollVerticalPercent(int percent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | percent | Percentage of the total content area [0-100] |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
ScrollVerticalSmall(Int32)
Scroll the element vertically in a small increment.
https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-scrollamount
Declaration
public IAllowSelectorActionOrAnySelector ScrollVerticalSmall(int iterations = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iterations | Negative iterations scroll up. |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
SendKey(Byte)
Type special characters like Enter, Page Up, Page Down, Tab, etc.
Use GPAL.VK constants for ease of access to commmon keys.
For all Virtual Keycodes, visit:
https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
Declaration
public IAllowSelectorActionOrAnySelector SendKey(byte VKCode)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte | VKCode | Virtual Keycode |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
Examples
// send CTRL-HOME
...
myBrowser
.PressModifierKey(ModifierKeys.Control)
.SendKey(GPAL.VK_HOME);
.WaitFor(150)
.ReleaseModifierKey(ModifierKeys.Control)
SendString(String)
Type in the literal string provided.
NOTE: If you press SHIFT then SendString a mixed-case string, SHIFT will be released.
To send ALL CAPS, press SHIFT then send an all lowercase string.
Declaration
public IAllowSelectorActionOrAnySelector SendString(string textToSend)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | textToSend | Text to type |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | Fluent interface to write your workflow |
SwitchToTab()
Switch to any TabControl defined in the current UOW. This will hardware click the tab control if the SelectionItemPattern fails to allow a click If .WithAllThatMatch is defined on the current UOW, GPAL will attempt to switch to {num} tabs that matched the Selector(s) in the current UOW.
Declaration
public IAllowAllActionAndAnySelector SwitchToTab()
Returns
| Type | Description |
|---|---|
| IAllowAllActionAndAnySelector | Fluent interface to write your workflow |
ToGPALObject()
Return a GPAL.Application object so that GPAL.Application does not have to be cast.
Declaration
public Application ToGPALObject()
Returns
| Type | Description |
|---|---|
| Application | A GPAL.Application object |
Examples
Application application = GPAL.Application
.WithParameters(@"C:\temp\ebay.words.txt")
.Open(@"C:\Program Files\Notepad++\notepad++.exe")
.WaitFor(5000)
.Maximize
.LeftClick()
.ToGPALObject();
WaitFor(Int32)
Either wait the amount of time specified or wait UP TO the amount of time specified waiting for elements to be found for the Selector(s) in the current UOW.
If an action has already been called, then this is interpretted as a sleep for the specified miliseconds.
If only selectors have been defined in the current UOW, then this is a delay waiting for the selectors to be present before continuing with the workflow.
Waiting for elements does not guarantee they will be present when the workflow continues. If they are not present, the CallIfNotFound handler will be invoked so you can deal with that.
NOTE: WaitFor is not considered an action, it defines a time to wait for elements to be present before trying to perform actions.
Declaration
public IAllowAfterWaitForAndSizeControl WaitFor(int timeoutInTicks)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | timeoutInTicks |
Returns
| Type | Description |
|---|---|
| IAllowAfterWaitForAndSizeControl | Fluent interface to write your workflow |
WaitForWindow(String)
Wait for a Windows window with title to appear on the desktop.
Used in conjunction with .WithWaitForWindowTimeout to set the wait duration in seconds.
Default is 10 seconds.
Declaration
public IAllowAfterWaitForAndSizeControl WaitForWindow(string windowTitle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | windowTitle |
Returns
| Type | Description |
|---|---|
| IAllowAfterWaitForAndSizeControl | Fluent interface to write your workflow |
WaitForWindowRegex(String)
Wait for a Windows window with title that matches the regex pattern to appear on the desktop.
Used in conjunction with .WithWaitForWindowTimeout to set the wait duration in seconds.
Default is 10 seconds.
Declaration
public IAllowAfterWaitForAndSizeControl WaitForWindowRegex(string windowTitleRegex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | windowTitleRegex |
Returns
| Type | Description |
|---|---|
| IAllowAfterWaitForAndSizeControl | Fluent interface to write your workflow |
WithAllThatMatch(Int32)
Indicates the Selectors refer to/match repeating, multiple elements on the page.
Use after all your .WithSelector statements. Used two ways.
For retrieving data: This is used to retrieve multiple rows of elements from the webpage, up to rowCount.
For input tokens/strings: This will repeat the same input into multiple elements, up to rowCount of lines.
For tokens, if columns repeat down the page, column 1 will be filled in with token 1, column 2 with token 2, etc.
This will be repeated for each row.
For extracting data from selectors using GetGrid/SaveTo[CSV/Excel/Tabbed] up to rowCount rows of elements matching the Selector will be retrieved for saving.
Again, rowCount column 1 going down a page will be retrieved, column 2, etc. that is then pivoted to an output of rows/columns
Declaration
public IAllowAfterAnySelectorExceptWithAll WithAllThatMatch(int rowCount = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowCount | The number of rows of matching elements to work with. |
Returns
| Type | Description |
|---|---|
| IAllowAfterAnySelectorExceptWithAll | Fluent interface to write your workflow |
WithName(String)
Declaration
public IAllowApplicationSettingsOrOpen WithName(string appName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | appName |
Returns
| Type | Description |
|---|---|
| IAllowApplicationSettingsOrOpen |
WithParameter(String)
Define the parameters to use in the Open command
Declaration
public IAllowApplicationSettingsOrOpen WithParameter(string parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameter |
Returns
| Type | Description |
|---|---|
| IAllowApplicationSettingsOrOpen |
WithPersistentSelector(Selector)
Add a persistent selector to the persistent UOW. Persistent selectors are always looked for whenever you perform an action on a UOW, like LeftClick, Hover, Focus, etc.
Use in conjunction with the PersistentCallIf handlers to create workflows to deal with the persistent selector(s).
Selectors may remove themselves from a UOW by using selector.Remove()
Only one persistent Unit of Work exists. All selectors are evaluated in the order they are defined.
Example: For applications, a persistent selector could be used with a timer in the callback, when elapsed time occurs, invoke an action on that Selector (like Save work).
Declaration
public IAllowPersistence WithPersistentSelector(Selector selector)
Parameters
| Type | Name | Description |
|---|---|---|
| Selector | selector | The GPAL Selector for the persistent element |
Returns
| Type | Description |
|---|---|
| IAllowPersistence | A fluent interface to define more persistent selectors |
WithSelector(Selector)
Add a selector to the current UOW. Selectors make up a Unit of Work (UOW) to perform actions upon.
A UOW is: All selectors defined between actions like Open, LeftClick, Hover, Focus, etc.
Use in conjunction with the CallIf handlers to create workflows to deal with found/not found selector(s).
Selectors may remove themselves from a UOW by using selector.Remove()
Declaration
public IAllowSelectorActionOrAnySelector WithSelector(Selector selector)
Parameters
| Type | Name | Description |
|---|---|---|
| Selector | selector | The GPAL Selector for the persistent element |
Returns
| Type | Description |
|---|---|
| IAllowSelectorActionOrAnySelector | A fluent interface to define more persistent selectors |
WithUseHardware(Boolean)
Force all workflow element interactions to use hardware emulation (selenium is default) NOTE: Not available for headless operations (GPAL.Browser.Get)
Declaration
public IAllowApplicationSettingsOrOpen WithUseHardware(bool trueFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | trueFalse |
Returns
| Type | Description |
|---|---|
| IAllowApplicationSettingsOrOpen | Fluent interface to specify more Browser settings |
WithWaitForWindowTimeout(Int32)
Define the time in seconds to WaitForWindow/Regex
Declaration
public IAllowAfterWaitForAndSizeControl WithWaitForWindowTimeout(int waitTimeInSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | waitTimeInSeconds |
Returns
| Type | Description |
|---|---|
| IAllowAfterWaitForAndSizeControl |