17using DocumentFormat.OpenXml.Drawing;
21using System.Collections.Generic;
22using System.Diagnostics;
26using System.Threading.Tasks;
89 #region <BrowserInterfaces>
117 IAllowToGPALObject<IBrowser>
120 bool? FileDownloaded {
get;
set; }
121 BrowserType BrowserType {
get; }
122 IWebDriver BrowserDriver {
get; }
128 int CurrentTabIdx {
get; }
129 string CurrentUrl {
get; }
130 string BrowserVersion {
get; }
131 object JavaScriptResultObj {
get; }
132 string JavaScriptResultStr {
get; }
133 PuppeteerCommunicator PuppeteerCommunicator {
get; }
134 IPuppeteerClient PuppeteerClient {
get; }
135 int ServerResponseCode {
get;
set; }
136 bool UseOttoMagic {
get; }
137 bool UsePuppeteer {
get; }
138 bool UseSelenium {
get; }
139 AutomationEngine AutomationEngine {
get; }
140 IRESTClient OttoMagicClient {
get; }
141 [Settings(Description =
"The hidden desktop this browser is running on, or null when it is on the visible one.")]
142 IHiddenDesktop HiddenDesktop {
get; }
144 bool IsAlive {
get; }
146 [Action(Description =
"Remove the CallIf handler everywhere it has been set. Use this once you are done using the handler.")]
147 void RemoveCallIfHandlerEverywhere(CallIfDelegate func);
148 MagicHelper MagicHelper {
get; }
156 [Settings(Description =
"What this desktop is called. Browsers naming the same one share it.")]
158 [Settings(Description =
"How many visible top level windows are on it right now.")]
159 int WindowCount {
get; }
160 [
Browser(Description =
"Put this desktop on the screen for the default time, then put yours back.")]
162 [
Browser(Description =
"Put this desktop on the screen for this many milliseconds, then put yours back.")]
163 string Peek(
int forMs);
164 [
Browser(Description =
"Give up GPAL's handle on this desktop. Closes nothing running there.")]
174 [Settings(Description =
"Every desktop made so far, in the order they were made.")]
175 IReadOnlyList<string> Names {
get; }
176 [Settings(Description =
"One desktop by name, so a workflow that did not keep the browser can still reach it.")]
178 [Settings(Description =
"Visible top level windows across every hidden desktop added up.")]
179 int WindowCount {
get; }
180 [Settings(Description =
"True while the screen is on a hidden desktop and has not been handed back.")]
181 bool IsShowing {
get; }
182 [
Browser(Description =
"Walk every hidden desktop that has windows, the default time each.")]
184 [
Browser(Description =
"Walk every hidden desktop that has windows, this many milliseconds each.")]
185 string Peek(
int forMsEach);
186 [
Browser(Description =
"Put one named desktop on the screen for the default time.")]
187 string Peek(
string desktopName);
188 [
Browser(Description =
"Put the screen back on the desktop a peek took it from. Safe from any thread.")]
190 [
Browser(Description =
"Give up GPAL's handles on every hidden desktop. Closes nothing running on them.")]
194 #region <BaseBrowserInterfaces>
203 [Settings(Description =
"Set which engine to use to automate the browser: OttoMagic, Puppeteer (default) or Selenium.")]
209 [Settings(Description =
"Set debug port to use [57005 (0xdead) default]. Specify to reconnect to a browser session using .WithExistingPort. If both port and pipe are set, port is preferred.")]
211 [Settings(Description =
"Use debug pipe for puppeteer commmunications. If both port and pipe are set, port is preferred.")]
213 [Settings(Description =
"Drive a browser whose GPALRestAPI is already running, here or on another machine, instead of launching one")]
218 [Settings(Description =
"")]
223 [Settings(Description =
"Load images in the page, this can affect layout and object coordinates, if that matters.")]
225 [Settings(Description =
"Scroll each scraped element into view as it is read, so the page follows the workflow. For watching a run, not for correctness. Ignored in headless. [false default]")]
227 [Settings(Description =
"Open PDF files externally, not in the browser. So, download the pdf.")]
229 [Settings(Description =
"Prompt when downloading a file? [true default/false for headless]")]
231 [Settings(Description =
"Location of the browser driver and where automatically updating the driver will occur. Default is executable directory.")]
232 IAllowBrowserSettingsOrGoTo WithDriverLocation([Directory(Description =
"Location of browser driver for this instance. [./ (default)(same dir as exe)]")]
string driverPath);
233 [Settings(Description =
"Control whether popups are blocked")]
235 [Settings(Description =
"Use javascript injection to interact with an element")]
237 [Settings(Description =
"Always overwrite a file if it exists")]
239 [Settings(Description =
"Wait for browser page to finish loading")]
241 [Settings(Description =
"How long a click waits to see whether it started a navigation. [250 (default)] 0 skips the check")]
243 [Settings(Description =
"Run the browser on a Win32 desktop object of its own, headful but invisible, so the workflow does not take the screen. Hardware engines cannot reach a desktop nobody is on and step down to the protocol engine of their own family.")]
245 [Settings(Description =
"Run the browser on the named Win32 desktop object. Browsers naming the same desktop share it, browsers naming different ones get one each.")]
247 [Settings(Description =
"To change browser profiles, use this option to specify the data-dir path. If Directory and UserName are both defined, Directory will be used.")]
249 [Settings(Description =
"To change browser profiles, use this option to specify the username whose browser data-dir to use. If Directory and UserName are both defined, Directory will be used.")]
251 [Settings(Description =
"The name of the browser profile to use under the data-dir (sometime, might be same result as UserName)")]
253 [Settings(Description =
"Set the browser default download directory. Can be overriden with a fully qualified filename. [path/file/]")]
255 [Settings(Description =
"Use websockets to download for Right Click and Download")]
257 [Settings(Description =
"Set the time in seconds to wait for a download to finish before giving up.")]
259 [Settings(Description =
"Set the HTTP referrer to use when navigating every subsequent Get/Goto. Use empty string to clear.")]
262 [Settings(Description =
"Launch a browser purely to read its real user agent. Off by default, in which case the user agent comes from WithUseUserAgent, then gpal.yaml, then the per-browser template with the installed version filled in")]
264 [Settings(Description =
"Set whether or not to obey robots.txt (false - default).")]
266 [Settings(Description =
"Set whether or not to respect robot meta tags noindex/nofollow/none (false - default).")]
271 [Action(Description =
"Open url in a new tab")]
273 [Action(Description =
"Open url in a new window")]
282 [Callback(Description =
"GLOBAL based callback if any selector in any UOW is found")]
284 [Callback(Description =
"GLOBAL based callback if any selector in any UOW is NOT found")]
286 [Callback(Description =
"Callback when something fails that the workflow can decide about, a navigation that never loaded a page being the case today. Falls through to GPAL.CallOnFail when this browser has none")]
288 [Settings(Description =
"Who this browser is, for a site that asks. The credential's WebAuthType decides how it is presented, and it is presented once at the first navigation")]
297 [Callback(Description =
"UOW based callback if any selector in the UOW is found")]
299 [Callback(Description =
"UOW based callback if any selector in the UOW is NOT found")]
301 [Callback(Description =
"UOW based callback when a row of input is consumed and entered.\nUseful for chaining to another workflow")]
311 [
Browser(Description =
"Set the desired browser window size.")]
316 [Action(Description =
"Hide the found element")]
338 [Action(Description =
"Directly set a DOM attribute (named by the preceding WithAttribute call) to the given value on the found element(s). Does not simulate typing and does not honor GPAL.TypingDelay.")]
351 [Action(Description =
"Set the value of the element(s) matched by the preceding WithSelector call from the value of the element matched by the given selector.")]
362 [Data(Description =
"Names the attribute to set; must be followed by .SetAttribute(value) to specify the value and complete the action.")]
367 [Action(Description =
"Left click the found element.")]
369 [Action(Description =
"Left click the found element.")]
371 [Action(Description =
"M iddle click the found element.")]
373 [Action(Description =
"Left click the found select menu element.")]
375 [Action(Description =
"Stealth (Runtime.disable before) Left click the found element.")]
377 [Action(Description =
"Left click the found element, pressing modifier key (none [default]) while clicking.")]
379 [Action(Description =
"Left click the found element, handling a download dialog after clicking.")]
381 [Action(Description =
"Left click the found element, handling an upload dialog after clicking.")]
383 [Action(Description =
"Left double click the found element, pressing modifier key (none [default]) while clicking.")]
385 [Action(Description =
"Right click the found element, pressing modifier key (none [default]) while clicking.")]
392 [Action(Description =
"Save the element (if WithSelector is specified) or page to the GPALFile.")]
397 [Wait(Description =
"After an action is called (ie, LeftClick), wait for a window to open with this name (title)")]
399 [Wait(Description =
"After an action is called (ie, LeftClick), wait for a window to open which name (title) matches the regular expression")]
401 [Wait(Description =
"The time in seconds to wait for a window to appear before giving up")]
407 [Data(Description =
"Send the specified string using the selector interaction type (selenium/javascript/hardware)")]
409 [Data(Description =
"Send a control character specified by the VKCode (GPAL has some defined)")]
411 [Data(Description =
"Press the modifier key specified (Control/Shift/Alt). NOTE: Be careful with Shift and sending mixed case strings after pressing Shift. Mixed case strings will release the Shift key.")]
413 [Data(Description =
"Release the modifier key specified (Control/Shift/Alt) as previously pressed.")]
416 [Data(Description =
"Fill in [overwrite] text from a string")]
418 [Data(Description =
"Append to the end text from a string")]
420 [Data(Description =
"Insert text (wherever the cursor is) from a string")]
423 [Data(Description =
"Fill in [overwrite] text from a file. CSV values per line takenized for each input selector")]
425 [Data(Description =
"Append to the end text from a file. CSV values per line takenized for each input selector")]
427 [Data(Description =
"Insert text (wherever the cursor is) from a file. CSV values per line takenized for each input selector")]
430 [Data(Description =
"Fill in [overwrite] text from a database query. Tokenized by each column per input per row")]
432 [Data(Description =
"Append to the end text from a database query. Tokenized by each column per input per row")]
434 [Data(Description =
"Insert text (wherever the cursor is) from a database query. Tokenized by each column per input per row")]
436 [Data(Description =
"Fill in [overwrite] text from a data grid. Tokenized List<List<string>> each string per input per list entry")]
438 [Data(Description =
"Append to the end text from a data grid. Tokenized List<List<string>> each string per input per list entry")]
440 [Data(Description =
"Insert text (wherever the cursor is) from a data grid. Tokenized List<List<string>> each string per input per list entry")]
442 [Data(Description =
"Set the value of an input range element")]
447 [
Browser(Description =
"Close the current tab [no URL], or the tab with URL")]
451 [
Browser(Description =
"Go to tab with URL")]
456 [
Selector(Description =
"Subsequent withselector searches are for elements nested under this element. Nesting is possible.")]
458 [
Selector(Description =
"Subsequent withselector searches are for elements nested under this iframe. Nesting is possible.")]
466 [
Selector(Description =
"Subsequent selector are for elements in a shadowdom specified by the shadowdom selector. Nesting is possible.")]
468 [
Selector(Description =
"Reset back to the top level dom document for finding elements")]
473 [Action(Description =
"Use javsacript injection to scroll the specified web element n pixels horizontally")]
475 [Action(Description =
"Use javascript injection to scroll the specified web element n pixels vertically")]
480 [
Browser(Description =
"Scroll the browser window horizontally by scrollAmount pixels")]
482 [
Browser(Description =
"Scroll the browser window veritcally by scrollAmount pixels")]
487 [
Browser(Description =
"Close the current window [no URL], or the window with URL")]
491 [
Browser(Description =
"Go to window with URL")]
506 [
Browser(Description =
"Execute the supplied javascript in the browser and return an integer in browser.JavaScriptResultObj")]
508 [
Browser(Description =
"Execute the supplied javascript in the browser and return an integer in browser.JavaScriptResultStr")]
513 [
Browser(Description =
"Answer the alert, confirm and prompt dialogs the page raises, instead of letting them open and block. True accepts (OK, and confirm returns true), false dismisses (Cancel, and confirm returns false). Set it before the browser launches.")]
515 [
Browser(Description =
"What a prompt hands back when dialogs are accepted. Not available on Selenium, where the driver answers the dialog itself.")]
517 [
Browser(Description =
"Stop answering dialogs, so they open and block again. Different from WithDialogsAccepted(false), which answers Cancel.")]
522 [
Browser(Description =
"Where this browser's window is and how big it is, in screen coordinates, chrome included. Answered by whichever engine is driving, so a workflow does not have to know which one that is.")]
527 [
Browser(Description =
"Inject a script (raw JS string, or GPALFile - if multiple files are specified, all are loaded and injected as separate scripts) to run on every new document load. Callable before the first .GoTo()/.Get() (active from the first page load) or at any later point (applies to subsequent navigations). Persists until .ClearInjectedScripts() is called.")]
529 [
Browser(Description =
"Inject script(s) loaded from a GPALFile - if multiple filenames are specified (e.g. via wildcard), all are loaded and injected as separate scripts.")]
531 [
Browser(Description =
"Remove all scripts previously registered via InjectScript.")]
536 [Settings(Description =
"Wait for browser network activity to idles. Defauilt is 0 connections.")]
538 [Settings(Description =
"Timeout to wait for network idle = true. Defauilt is 500 ms.")]
540 [Settings(Description =
"Timeout to wait for network idle = true. Defauilt is 500 ms.")]
542 [Settings(Description =
"Duration to maintain network stats before pruning old data. Default is 10 seconds (10_000 ms).")]
546 #endregion <BaseInterfaces>
549 public interface IAllowToGPALObject<TResult>
551 [Fluent(Description =
"Ends a declaration or workflow, returning a GPAL object which can be assigned. Use instead of an explicit cast. [ Selector mySel = GPAL.Selector.WithCSS(css).ToGPALObject() ]")]
552 TResult ToGPALObject();
560 [
Selector(Description =
"Add literal data to a grid by invoking this function when using .GetGrid")]
IAllowAfterAnySelector WithSelector(Func<string> dataFunction);
564 [Action(
"Get the current page source")]
566 [Action(
"Carry on without the browser: hand back a RESTClient holding this browser's origin, cookies, user agent, accept language and credential")]
568 [Action(
"Get the raw sitemap XML")]
570 [Action(
"Get the sitemap URLs as a List<string>")]
572 [Action(
"Save the sitemap URLs to a file, format chosen by the file extension")]
574 [Action(
"Clear cached sitemap / LLM digest / hydration results, forcing the next Get/Save to refetch")]
576 [Action(
"Get the current page source as an LLM digest")]
578 [Action(
"Save to file, the current page source as an LLM digest")]
580 [Action(
"Get the current page next.js hydrated data")]
582 [Action(
"Save to file, the current page next.js hydrated data")]
587 [Action(
"Run the get storage actions for storageType")]
589 [Action(
"Run the set storage actions for storageType")]
591 [Action(
"Run the delete storage actions for storageType")]
596 [
Browser(Description =
"The domain for the storage action")]
598 [
Browser(Description =
"The path for the storage action")]
600 [
Browser(Description =
"The key for the storage action")]
602 [
Browser(Description =
"The store name for the indexedDb action")]
604 [
Browser(Description =
"The user defined filter to help select wildcard storage actions")]
612 public interface IAllowClose { [
Browser(Description =
"Close the current browser session. True [default] to kill web drivers running.")]
void Close(
bool killWebDrivers =
false); }
621 [Data(Description =
"Values .Fetch drops into its request's numbered tokens, one row per set of requests. Column 0 fills {0}, column 1 fills {1}, and so on")]
623 [Data(Description =
"Values .Fetch drops into its request's numbered tokens, from a file. CSV values per line, one line per set of requests")]
625 [Data(Description =
"Values .Fetch drops into its request's numbered tokens, from a database query. One column per token, one row per set of requests")]
627 [Data(Description =
"Values .Fetch drops into its request's numbered tokens, as a single row of comma separated values")]
630 public interface IAllowGetGrid { [Data(Description =
"Retrieve data and add it into this GPALGrid. Pass a grid configured with .WithDedupeData(true) to skip duplicate rows. GPAL keeps one internally for a workflow if you pass null.")]
IAllowWithHeaderOrFileActions GetGrid(ref IGPALGrid<string> returnGrid); }
631 public interface IAllowGetElements { [Data(Description =
"Find elements for all selectors in this UOW and return them as a unified List<GPALElement>. Results are also available per-selector via selector.WebSelectorFoundResults.")]
IAllowBrowserActionOrAnySelector GetElements(out List<GPALElement> elements); }
632 public interface IAllowWithHeader { [Data(Description =
"Column header for exported data. If a selector is not given a new (.WithName), use this. Or use this instead of the name when used on a Selector.")]
IAllowWithHeaderOrFileActions WithHeader(
string header); }
633 public interface IAllowWithAllThatMatch { [Data(Description =
"How many items per page to retrieve OR total items to retrieve. Defaults to int.MaxValue, get all items that match. If less than returns on a page, retrieve only rowCount, rows of results per page. If greater than the number of results on a page, this is the total number of results to return.")]
IAllowAfterAnySelectorExceptWithAll WithAllThatMatch(
int rowCount =
int.MaxValue); }
638 [Wait(Description =
"IF after an action is called, this is a sleep timer. If used after adding selectors (.WithSelector) [before calling an action], this is the time to wait to find elements for .WithSelectors before continuing the workflow (can cause to invoke CallIfNotFound handler)")]
640 [Wait(Description =
"Wait for the Selector before proceeding with the workflow. Use WaitFor(timeInMs) or use the default of three [3] seconds. Similar to .WithSelector.WaitFor.Action (can cause to invoke CallIfNotFound handler)")]
642 [Wait(Description =
"Wait for the element(s) defined using .WithSelector to enter the specified state.")]
646 public interface IAllowStartWorkflow { [Fluent(Description =
"Start the workflow if no action is used to start the workflow. Perhaps your logic is in the CallIf handlers, so this will kick off finding the selector elements, thus calling Found/NotFound handlers")]
IAllowBrowserActionOrAnySelector StartWorkflow(); }
649 [Fluent(Description =
"Perform a drag-and-drop operation. OffsetX/Y is the grab point, DeltaX/DeltaY is the drop offset. Uses native drag events for the current automation engine (Selenium Actions, CDP mouse events, or OttoMagic in-page events); falls back to smoothed hardware mouse emulation for image-matched/remote-desktop elements")]
651 [Fluent(Description =
"Perform a drag-and-drop operation while pressing a modifier key. OffsetX/Y is the grab point, DeltaX/DeltaY is the drop offset. Uses native drag events for the current automation engine (Selenium Actions, CDP mouse events, or OttoMagic in-page events); falls back to smoothed hardware mouse emulation for image-matched/remote-desktop elements")]
656 [Fluent(Description =
"Print the element defined by .withselector/page (if no selector set) to PDF file.")]
658 [Fluent(Description =
"Print orientation for PrintToPDF - use before calling PrintToPDF")]
663 [Fluent(Description =
"Cast the current tab to the specified device")]
665 [Fluent(Description =
"Cast the desktop to the specified device")]
667 [Fluent(Description =
"Stop casting to device")]
672 #region <DerivedInterfaces>
713 [Action(Description =
"Wait for the page to make a matching call and hand it back as a request ready to issue")]
724 , IAllowToGPALObject<IBrowser>
746 [Fluent(Description =
"Issue an API request from inside the page, so it carries the session the browser already earned: its cookies, TLS fingerprint, header order and any anti-bot clearance. Honors .WithPages and .WithTokensFrom. The response bodies are handed back with .SaveTo(ref string)")]
748 [Action(Description =
"Record what the page asks for, so an endpoint can be read off a site")]
750 [Action(Description =
"Record what the page asks for and hand back everything recorded so far")]
752 [Action(Description =
"Forget everything recorded so far, so what comes next is what happens next")]
754 [Settings(Description =
"Only record calls whose url holds this")]
790 , IAllowToGPALObject<IBrowser>
820 , IAllowToGPALObject<IBrowser>
861 #endregion <DerivedInterfaces>
862 #region Workflow Interfaces
865 [Workflow(Description =
"Runs the workflows added to this browser, in the order they were added.")]
870 [Workflow(Description =
"Executes the workflow while the predicate returns true.")]
873 [Workflow(Description =
"Executes the workflow until the specified selector finds at least one element.")]
876 [Workflow(Description =
"Executes the workflow until the predicate returns true.")]
879 [Workflow(Description =
"Sets the timeout in milliseconds for While or Until loops.")]
882 [Workflow(Description =
"Sets the maximum number of iterations for While or Until loops.")]
887 [Workflow(Description =
"Adds a workflow to be scheduled. It builds and owns whatever it drives.")]
892 [Settings(Description =
"How many workflows may be in flight at once. One, the default, runs them one after another.")]
894 [Settings(Description =
"The least time between two workflows starting. [250ms (default)] 0 starts them together.")]
896 [Settings(Description =
"How long to wait for them all before giving up and reporting the unfinished ones as failed. [no limit (default)]")]
898 [Workflow(Description =
"Runs every workflow added and waits for them all.")]
900 [Workflow(Description =
"Runs every workflow added and hands back what happened to each.")]
905 [Workflow(Description =
"Defines a workflow to be executed repeatedly based on While or Until conditions.")]
908 #endregion Workflow Interfaces
909 #endregion <BrowserInterfaces>
910 #region <Element Assistant Interfaces>
917 [Action(Description =
"Left click the specified element, pressing modifier key (none [default]) while clicking.")]
919 [Action(Description =
"Left click the specified element.")]
921 [Action(Description =
"Left click the specified element, pressing modifier key (none [default]) while clicking.")]
923 [Action(Description =
"Left double click the specified element, pressing modifier key (none [default]) while clicking.")]
925 [Action(Description =
"M iddle click the found element.")]
927 [Action(Description =
"Right click the specified element, pressing modifier key (none [default]) while clicking.")]
929 [Data(Description =
"Fill in [overwrite] text from a string")]
931 [Data(Description =
"Insert text (wherever the cursor is) from a string")]
933 [Data(Description =
"Append to the end text from a string")]
935 [Data(Description =
"Send a control character specified by the VKCode (GPAL has some defined)")]
937 [Data(Description =
"Send the specified string using the selector interaction type (selenium/javascript/hardware)")]
939 [Data(Description =
"Press the modifier key specified (Control/Shift/Alt). NOTE: Be careful with Shift and sending mixed case strings after pressing Shift. Mixed case strings will release the Shift key.")]
941 [Data(Description =
"Release the modifier key specified (Control/Shift/Alt) as previously pressed.")]
943 [Action(Description =
"Use javascript injection to scroll the specified web element n pixels horizontally")]
945 [Action(Description =
"Use javascript injection to scroll the specified web element n pixels vertically")]
950 [ElementAssitant(Description =
"Declare the element to interact with using the ElementAssistant")]
956 #endregion <\Element Interfaces>
957 #region <File Interface>
962 [File(Description =
"Save the retrieved grid. Output format and delimiter are determined by the GPALFile (its extension, or explicit file settings).")]
964 [File(Description =
"Append the retrieved grid. Output format and delimiter are determined by the GPALFile (its extension, or explicit file settings).")]
966 [File(Description =
"Hand back what .Fetch retrieved, as a JSON array holding one response body per page requested.")]
970 #region Graphics Interface
973 [
GPAL(Description =
"Capture a screenshot")]
980 [
GPAL(Description =
"Save to BASE64 string")]
983 [File(Description =
"Save to file (overwrite)")]
991 #endregion Graphics Interface
998 string CaptureVisibleTab();
999 string CheckNetworkIdle(
int? maxConnections =
null,
int? timeoutMs =
null,
int? pruneMs =
null);
1000 TabTuple CloseTab(dynamic URLorTabId =
null);
1001 bool DeleteStorage(WebsiteStorageType storageType,
bool deleteAcrossOrigins =
false,
string domain =
null,
string path =
null,
string key =
null,
string storeName =
null);
1005 string GetContentAndCss(
string elementId);
1006 Dictionary<string, object> GetCssAttributes(
string elementId);
1007 Dictionary<string, object> GetDomAttributes(
string elementId);
1008 Dictionary<string, object> GetDomProperties(
string elementId);
1009 string GetCurrentUrl();
1010 string GetReadyStatus(
string sessionToken);
1012 string GetStorage(WebsiteStorageType storageType,
string domain =
null,
string path =
null,
string key =
null,
string storeName =
null);
1014 TabTuple GotoTab(dynamic URLorTabId);
1015 System.Drawing.Rectangle GetWindowRectangle();
1016 void SwitchToElement(
string elementId);
1017 void InFrame(
string elementId);
1020 void MoveTo(
string elementiId);
1025 void OverrideReferrer(
string referrer);
1026 void SetUserAgent(
string userAgent);
1031 void PressModifierKey(ModifierKeys modifierKeys);
1034 void ReleaseModifierKey(ModifierKeys modifierKeys);
1036 void ScrollWindowByHorizontal(
int pixels);
1037 void ScrollWindowByVertical(
int pixels);
1038 void SetRange(
string elementId,
int rangeValue);
1039 bool SetStorage(WebsiteStorageType storageType,
string data,
string domain =
null,
string path =
null,
string key =
null,
string storeName =
null);
1040 void StealthOverrideReferrer();
1041 void WithDownloadFile(
string downloadPath);
1042 void Focus(
string elementId);
1043 void FireChangeEvent(
string elementId);
1044 void ScrollIntoView(
string elementId);
1045 void ScrollElement(
string elementId,
int hPixels,
int vPixels);
1046 string GetElementAttributeHash(
string elementId);
1047 string GetPageSource();
1049 string GetAttribute(
string elementId,
string attribute);
1050 void SetAttribute(
string elementId,
string attribute,
string value);
1051 void SetValueFromElement(
string srcSelector,
string destElementId);
1052 void LeftClick(
string elementId);
1053 void LeftDoubleClick(
string elementId);
1054 void MiddleClick(
string elementId);
1055 void RightClick(
string elementId);
1056 void SelectClick(
string elementId, dynamic indexOrValue);
1057 bool IsVisibleInViewport(
string elementId);
1059 void Hover(
string elementId);
1060 void DragAndDrop(
string elementId,
int deltaX,
int deltaY,
int offsetX = 0,
int offsetY = 0);
1061 int WindowInnerHeight();
1062 int WindowInnerWidth();
1063 int WindowOuterHeight();
1064 int WindowOuterWidth();
1065 string Fetch(
string url,
string method =
null,
string body =
null,
string contentType =
null,
string[] headers =
null,
bool asBytes =
false);
1066 int WindowPageOffsetX();
1067 int WindowPageOffsetY();
1068 System.Drawing.Rectangle GetBoundingClientRect(
string elementId);
1069 void HideElement(
string elementId);
1070 void InjectScript(
string script);
1071 void ClearInjectedScripts();
1072 bool IsClickAble(
string elementId);
1073 void ClearReferrer();
1075 List<GPALElement> EvaluateAll(
string xpath);
1077 List<GPALElement> EvaluateAllPersistent(
string xpath);
1078 string GetLanguages();
1079 string GetUserAgent();
1080 List<GPALElement> GetOptions(
string elementId);
1081 void FillInAppend(
string elementId,
string text);
1082 void FillInInsert(
string elementId,
string text);
1083 void FillInOverwrite(
string elementId,
string text);
1084 void LeftClickAndDownload(
string elementId,
string filenameAndPath);
1085 void LeftClickAndUpload(
string elementId,
string filenameAndPath);
1086 void LeftClickAndUpload(
string elementId,
GPALFile filenamesAndPaths);
1088 List<GPALElement> QueryPersistentSelectors(
string css);
1090 List<GPALElement> QuerySelectors(
string css);
1091 void ScrollWindow(
int hPixels,
int vPixels);
1092 void SendKey(
byte vkcode);
1093 void SendString(
string text,
int delayMs = 0);
1094 void SubmitForm(
string elementId);
1095 void SwitchToDefaultContent();
1097 void SwitchToShadowRoot(
string elementId);
1098 string GetBrowserSettings();
1099 string GetGpalSettings();
1100 string GetSettings();
1101 string GetWorkflow();
1103 bool TopBrowser(Process process);
1107 [
Browser(Description =
"Move to the next window (to the right)")]
1109 [
Browser(Description =
"Move to the previous window (to the left)")]
1112 int WindowScreenLeft();
1113 int WindowScreenTop();
1115 #endregion MagicHelper
1116 #region Google Sheets
1206 [Settings(Description =
"Drive sheets through an Apps Script web app deployed by hand, instead of the Sheets API. Takes the deployment url and needs no credentials.")]
1209 #endregion Google Sheets
1210 #region PuppeteerClient / based entirely on restclient
1281 Task<string> ExecuteAsync();
1282 Task<T> ExecuteAsync<T>();
1299 [Workflow(Description =
"Sets the timeout in milliseconds for While or Until loops.")]
1302 [Workflow(Description =
"Sets the maximum number of iterations for While or Until loops.")]
1371 [Fluent(Description =
"Issue an API request from inside the page, so it carries the session the browser already earned: its cookies, TLS fingerprint, header order and any anti-bot clearance. A relative url resolves against wherever the browser currently is")]
1507 string Name {
get; }
1509 #endregion Puppeteer
1598 List<StorageAction> Add(List<StorageAction> storageActions);
Browser object that contains the fluent methods to create your Browser workflow. Instatiated using G...
delegate CallIfStatus CallAfterFillInDelegate(IBrowser browser, IGPALGrid< string > tokens, int tokenIdx)
Delegate callback for the CallAfterFillIn EventHandler which will be invoked after each row of tokens...
delegate CallIfStatus CallOnFailDelegate(IBrowser browser, GPALFailure failure, string detail)
Delegate for the CallOnFail handler, invoked when something fails that the workflow,...
delegate CallIfStatus CallIfDelegate(IBrowser browser, List< IGPALElement > foundElements, List< IGPALElement > matchedElements, Selector selector, bool matchedAll)
Delegate callback for the CallIfFound/CallIfNotFound EventHandlers which will be invoked when a selec...
Represents a URL with optional pre-navigation storage cleanup / inspection actions....
Represents a single storage-related action to perform before navigating to a URL.
Class to define database usage. Currently only used for input from a table, sql or stored procedure....
Pseudo element used in Applications and Browser workflows for image matching and unified automation....
GPAL File object instantied with GPAL.File Used to load tokens into a GPALGrid [rows/columns].
Everything starts here, all the GPAL controls and global settings using fluent syntax are here....
Describes an API request for .Fetch to issue from inside the page, so it carries the session the brow...
GPAL Selector used to locate Application and Browser elements. Instantiated with GPAL....
Allow Browser Settings, Goto, WaitOnDocumentReady.
What a workflow may say once .WithCallFilter has said which call it is after. Taking a template only ...
Starting interface - only allows setting the target URL.
IAllowGPALUrlStorageType ForUrl(string url)
Sets the target URL (blank or null becomes https://google.com).
Allow setting the storage data parameter for 'set' operations.
IAllowGPALUrlStorageItemConfig WithStorageData(string data)
Optional: domain override.
Interface after deleting a specific item - allows optional path/domain.
IAllowGPALUrlStorageItemConfig WithStorageKey(string key)
Specific key for the current storage type.
IAllowGPALUrlStorageItemConfig WithDeleteAcrossOrigins(bool trueFalse)
OttoMagic Only: For delete operations without a domain, limit to origin? true = delete across origins...
IAllowGPALUrlStorageItemConfig WithStorageDomain(string domain)
Optional: domain override.
IAllowGPALUrlStorageItemConfig WithStorageStoreName(string storeName)
For indexedDb, this is the 'table' the object store, they call it a store name.
IAllowGPALUrlStorageItemConfig WithStoragePath(string path)
Optional: path (e.g. cookie path, object store name).
IAllowGPALUrlStorageItemConfig WithUserDefined(string userDefined)
User defined data, strictly used for filtering in GPAL. Can store data of value.
Interface after URL is set - allows selecting storage type.
IAllowGPALUrlStorageItemConfig WithStorageType(WebsiteStorageType type)
Start declaring the storage action with storage type first.
IAllowAfterAnySelector InShadowDom(Selector shadowDomSelector)
NOTE: can only use CSS selectors in shadow dom.
IAllowPuppeteerInputText FillInInsert(dynamic elementOrelementId, int delayMs=0)
IAllowPuppeteerExecution SendString(string text, int delayMs=0)
Simulates typing: dispatches real key events character-by-character. Honors GPAL.TypingDelay when del...
IAllowPuppeteerInputText FillInOverwrite(dynamic elementOrelementId, int delayMs=0)
IAllowPuppeteerInputText FillInAppend(dynamic elementOrelementId, int delayMs=0)
Sets the element's value directly (fast path) - does NOT honor GPAL.TypingDelay. delayMs only paces ...
IAllowBrowserActionOrAnySelector SetAttribute(string value)
Directly sets a DOM attribute on the found element(s) via element.setAttribute(attribute,...
IAllowBrowserActionOrAnySelector SetValueFrom(Selector selector)
Copies the value from the element matched by selector into the element(s) matched by the preceding I...
IAllowSetAttributeValue WithAttribute(string attribute)
Names the DOM attribute to set on the found element(s). Must be followed by IAllowSetAttributeValue....
string RestApiBaseUrl
Where this browser's GPALRestAPI is listening, e.g. http://localhost:3117/, taken from the port it an...
Public interface exposed to consumers.
string Url
The target URL (never null).
IReadOnlyList< StorageAction > GetActions()
List of storage actions to perform before navigation.
One Win32 desktop object a browser is running on. Reached from the browser that is on it,...
Every hidden desktop this process has made, and the screen itself. Peek and Return move the screen,...