GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
SelectorSettings.cs
1// =============================================================================
2// GPAL - Generally Positive Automation Library
3// Copyright © 2026 Software Decisions, Inc. All rights reserved.
4//
5// This file is part of GPAL.
6// Licensed under the Business Source License 1.1
7//
8// Primary development, architecture, and vision by Michael B. Vederman,
9// CEO of Software Decisions, Inc., Texas.
10//
11// Internal development maintained privately.
12// Public releases appear on GitHub: https://github.com/SoftwareDecisionsInc/GPAL.
13//
14// See LICENSE for full terms, including Additional Use Grant.
15// =============================================================================
16
17using System;
18using System.Collections.Generic;
19using System.Drawing;
20using System.Linq;
21using System.Text;
22using System.Threading.Tasks;
23using OpenQA.Selenium;
24using static GenerallyPositive.Enums;
26using System.Windows.Automation;
28
29namespace GenerallyPositive
30{
34 public class SelectorSettings
35 {
36 internal string Name { get; set; } = null; // intially asigned by GPAL factory
40 public class SelectorPathEntry
41 {
45 public SelectorPathType SelectorPathType { get; internal set; } = SelectorPathType.NotSet;
49 public string SelectorPath { get; internal set; } = null;
53 public List<GPALElement> WebSelectorFoundResults { get; internal set; } = null;
57 public List<GPALElement> WebSelectorMatchedResults { get; internal set; } = null;
61 public List<GPALAutomationElement> AppSelectorFoundResults { get; internal set; } = null;
65 public List<GPALAutomationElement> AppSelectorMatchedResults { get; internal set; } = null;
69 public Image Image { get; internal set; } = null;
70 internal SelectorPathEntry()
71 {
72 }
73 }
74 internal class MatchCriteriaEntry
75 {
76 public string StringToMatch { get; set; } = null;
77 internal MatchType MatchType { get; set; } = MatchType.None;
78 internal bool ExactMatch { get; set; } = true;
79 public Selector.webMatchingFunction WebMatchingFunction { get; set; } = null;
80 public Selector.appMatchingFunction AppMatchingFunction { get; set; } = null;
81 }
85 public SelectorType SelectorType { get; internal set; } = SelectorType.Selector;
86 public Func<string> DataFunction { get; internal set; }
87 internal List<SelectorPathEntry> SelectorPaths { get; set; } = null;
88 internal List<MatchCriteriaEntry> MatchCriteria { get; set; } = null;
89 internal string AttributeName { get; set; } = null;
90 internal InteractionType InteractionType { get; set; } = InteractionType.Puppeteer; // resolved for the engine in play, recomputed every time the selector is attached
91 internal InteractionType? RequestedInteractionType { get; set; } = null; // what the workflow explicitly asked for, null when it never said. never overwritten by resolution
92 internal string HRef { get; set; } = null;
93 internal int OffsetX { get; set; } = 0; // offset to click from the top left corner of the element found
94 internal int OffsetY { get; set; } = 0; // offset to click from the top left corner of the element found
95 internal int DeltaX { get; set; } = 0; // drag-and-drop distance moved from the click point described by offsetX
96 internal int DeltaY { get; set; } = 0; // drag-and-drop distance moved from the click point described by offsetY
97 internal bool DeleteMe { get; set; } = false; // to allow a CallIF handler to 'remove' a selector from the SelectorList
98 internal bool SearchForSelector { get; set; } = true;
99 public List<CallIfDelegate> CallIfFound { get; internal set; }
100 public List<CallIfDelegate> CallIfNotFound { get; internal set; }
101 internal List<CallIfDelegate> RemovedMethods { get; set; } // handlers RemoveCallIfHandlerEverywhere took out of play - a soft delete so the handler list survives to be reused and can be inspected
102 internal List<Application.Application.CallIfDelegate> AppCallIfFound { get; set; }
103 internal List<Application.Application.CallIfDelegate> AppCallIfNotFound { get; set; }
104 public CallIfStatus CallIfFoundHandled { get; internal set; } = CallIfStatus.NotHandled;
105 public CallIfStatus CallIfNotFoundHandled { get; internal set; } = CallIfStatus.NotHandled;
106 public CallIfStatus AppCallIfFoundHandled { get; internal set; } = CallIfStatus.NotHandled;
107 public CallIfStatus AppCallIfNotFoundHandled { get; internal set; } = CallIfStatus.NotHandled;
108 internal bool SimulateMouse { get; set; } = false;
109 internal bool StopOnNotFound { get; set; } = false;
110 internal int ElementsFoundAndMatchedCount { get; set; } = 0;
111 internal Selector InFrame { get; set; } = null;
112
113 internal SelectorSettings()
114 {
115 SelectorPaths = new List<SelectorPathEntry>();
116 MatchCriteria = new List<MatchCriteriaEntry>();
117 CallIfFound = new List<CallIfDelegate>();
118 CallIfNotFound = new List<CallIfDelegate>();
119 RemovedMethods = new List<CallIfDelegate>();
120 AppCallIfFound = new List<Application.Application.CallIfDelegate>();
121 AppCallIfNotFound = new List<Application.Application.CallIfDelegate>();
122 }
123 }
124}
125
Browser object that contains the fluent methods to create your Browser workflow. Instatiated using G...
Definition Browser.cs:68
An entry defining a selector locator, a selector path.
List< GPALAutomationElement > AppSelectorFoundResults
UIAutomation elements found for this selector.
List< GPALElement > WebSelectorMatchedResults
Web elements matched out of the found selectors.
List< GPALElement > WebSelectorFoundResults
Web elements found for this selector.
SelectorPathType SelectorPathType
THe type of selector, css, xpath, text, etc.
string SelectorPath
The actual selector string.
Image Image
The image to match to create a psuedo element.
List< GPALAutomationElement > AppSelectorMatchedResults
UIAutomation elements matched out of the found selectors.
SelectorType SelectorType
Type of selector: A selector for an element, or literal data or a data function for dynamic data not ...