### Install RoboSAPiens Library Source: https://github.com/imbus/robotframework-robosapiens/blob/main/python/README.md Install the RoboSAPiens library using pip. This command installs the package and its dependencies. ```bash pip install robotframework-robosapiens ``` -------------------------------- ### Setup Helper Arguments Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Sets up arguments for a helper function, including parameters and initialization. Returns an object with parameter details. ```javascript setupHelper:function(e,t,r){var n=[] var o=this.setupHelperArgs(t,e,n,r) return{params:n,paramsIni ``` -------------------------------- ### Handlebars Environment Setup Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Sets up the Handlebars environment, including registering helpers and defining constants for compiler versions and logging. ```javascript var e_ = {}; function eS(e) { return e && e.__esModule ? e : { default: e }; } t(e_, "__esModule", () => k, e => k = e), t(e_, "HandlebarsEnvironment", () => _, e => _ = e), t(e_, "VERSION", () => S, e => S = e), t(e_, "COMPILER_REVISION", () => b, e => b = e), t(e_, "LAST_COMPATIBLE_COMPILER_REVISION", () => w, e => w = e), t(e_, "REVISION_CHANGES", () => E, e => E = e), t(e_, "log", () => x, e => x = e), t(e_, "createFrame", () => C, e => C = e), t(e_, "logger", () => L, e => L = e); k = !0, _ = e9; ``` -------------------------------- ### Wildcard Setup for RegExp Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Prepares wildcard characters (*?, **). Replaces them with internal placeholders for later processing. ```javascript setupWildcardsRegExp:function(e){return(e=e.replace(/(?:\\)*\?/g,function(e){return"\\\\"===e.charAt(0)?"?":"\\x01"})).replace(/(?:\\)*\*\*/g,function(e){return"\\\\"===e.charAt(0)?"*":"\\x02"})} ``` -------------------------------- ### Untick Checkbox Examples Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Demonstrates different ways to locate and untick a checkbox using its label. ```Robot Framework Untick Checkbox label ``` ```Robot Framework Untick Checkbox @ label ``` ```Robot Framework Untick Checkbox left label @ label above ``` -------------------------------- ### Prepare Program Structure Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Creates a Program object, which represents a sequence of statements. It captures the start and end location of the program body. ```javascript eo=function(e,t){if(!t&&e.length){var r=e[0].loc,n=e[e.length-1].loc;r&&n&&(t={source:r.source,start:{line:r.start.line,column:r.start.column},end:{line:n.end.line,column:n.end.column}})}return{type:"Program",body:e,strip:{},loc:t}} ``` -------------------------------- ### Setup Full Mustache Parameters Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Sets up full parameters for a Mustache statement, including pushing programs and handling hash parameters. It can also handle empty hashes. ```javascript var o=e.params;return this.pushParams(o),this.opcode("pushProgram",t),this.opcode("pushProgram",r),e.hash?this.accept(e.hash):this.opcode("emptyHash",n),o} ``` -------------------------------- ### Get Row Count Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Retrieves the number of rows in a specified table. Defaults to table 1 if no table number is provided. ```Robot Framework ${row_count} Get Row Count ``` -------------------------------- ### Handlebars Compilation Setup Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Sets up the Handlebars compilation process, including parsing, compiling the AST, and generating JavaScript code. Supports options like data and compatibility modes. ```javascript var rt=em(tY=tY.default),rr=em(tC),rn=em(td),ro=tv.default.create;function ri(){var e=ro();return e.compile=function(t,r){var n=t,o=r,i=e;if(void 0===o&&(o={}),null==n||"string"!=typeof n&&"Program"!==n.type)throw new tG.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+n);"data"in(o=A({},o))||(o.data=!0),o.compat&&(o.useDepths=!0);var a=void 0;function s(){var e=i.parse(n,o),t=new i.Compiler().compile(e,o),r=new i.JavaScriptCompiler().compile(t,o,!0);return i.template(r)}function l(e,t){return a||(a=s()),a.call(this,e,t)}return l._setup=function(e){return a||(a=s()),a._setup(e)},l._child=function(e,t,r,n){return a||(a=s()),a._child(e,t,r,n)},l},e.precompile=function(t,r){var n=t,o=r,i=e;if(null==n||"string"!=typeof n&&"Program"!==n.type)throw new tG.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+n);"data"in(o=o||{})||(o.data=!0),o.compat&&(o.useDepths=!0);var a=i.parse(n,o),s=new i.Compiler().compile(a,o);return new i.JavaScriptCompiler().compile(s,o)},e.AST=t_.default,e.Compiler=tz,e.JavaScriptCompiler=rt.default,e.Parser=J,e.parse=tU,e.parseWithoutProcessing=tq,e}var ra=ri(); ``` -------------------------------- ### Open SAP Application Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Opens SAP GUI or SAP Business Client. Specify the executable path and optional arguments for starting SAP. Ensure backslashes in paths are doubled or use the ${/} variable separator. ```Robot Framework Open SAP path ``` ```Robot Framework C:\\Program Files (x86)\\SAP\\FrontEnd\\SAPgui\\saplogon.exe ``` ```Robot Framework C:\\Program Files\\SAP\\FrontEnd\\SAPgui\\saplogon.exe ``` ```Robot Framework C:\\Program Files\\SAP\\NWBC800\\NWBC.exe ``` ```Robot Framework Open SAP C:\\Program Files\\SAP\\FrontEnd\\SAPgui\\sapshcut.exe -sysname=XXX -client=NNN -user=%{username} -pw=%{password} ``` -------------------------------- ### Select Menu Entry Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Selects a menu entry using its full path, with '/' as the separator. For example, 'System/User Profile/Own Data'. ```Robot Framework Select Menu Entry menu_entry_path ``` -------------------------------- ### Switch Page by ID Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Activates a specific browser page using its ID. This keyword is used after obtaining the page ID, for example, by using 'Get Page Id by Title'. ```Robot Framework Switch Page ${id} ``` -------------------------------- ### Ignore Joiners Setup for RegExp Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Prepares the string for ignore joiners and punctuation by adding a null character placeholder. Prevents incorrect matches across punctuation. ```javascript setupIgnoreJoinersRegExp:function(e){return e.replace(/[^(\|)\\]./g,function(e,t,r){var n=r.charAt(t+1);return/(\|)\\/.test(n)||""===n?e:e+"\\x00"})} ``` -------------------------------- ### Fill Text Field with F1 Help Text Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Fills a text field using its F1 help text as a locator, useful when other labels are not unique or present. ```Robot Framework Fill Text Field unique label >> F1 help text content ``` -------------------------------- ### Configure Environment for Embedded Browser Automation Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Environment variable and SAP GUI settings required to enable automation of embedded browser controls. This setup is necessary before using Browser Library with SAP. ```Shell Name: WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS Value: --enable-features=msEdgeDevToolsWdpRemoteDebugging --remote-debugging-port=4711 ``` -------------------------------- ### Select Text Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Selects text based on a locator. Supports selecting text starting with a substring or text following a label. ```Robot Framework Select Text = substring ``` ```Robot Framework Select Text Label ``` -------------------------------- ### Fill Text Field by Name Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Fills a text field using its name obtained from the Scripting Tracker. This serves as a last resort locator. ```Robot Framework Fill Text Field name content ``` -------------------------------- ### Handlebars Environment and Utilities Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Provides core Handlebars functionality including environment setup, version information, and utility functions for expression escaping, checking emptiness, and creating frames. ```javascript var e_={};t(e_,"__esModule",()=>k,e=>k=e),t(e_,"HandlebarsEnvironment",()=>_,e=>_=e),t(e_,"VERSION",()=>S,e=>S=e),t(e_,"COMPILER_REVISION",()=>b,e=>b=e),t(e_,"LAST_COMPATIBLE_COMPILER_REVISION",()=>w,e=>w=e),t(e_,"REVISION_CHANGES",()=>E,e=>E=e),t(e_,"log",()=>x,e=>x=e),t(e_,"createFrame",()=>C,e=>C=e),t(e_,"logger",()=>L,e=>L=e),k=!0,_=e9 ``` -------------------------------- ### Get Window Title Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Retrieves the title of the currently active window. This is useful for identifying or verifying the active application window. ```Robot Framework ${title} Get Window Title ``` -------------------------------- ### Fill Cell Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Fills a cell in a table with specified content. The row and column locators are used to identify the target cell. ```Robot Framework Fill Cell row_locator column content ``` -------------------------------- ### Setting Options for RoboSapiens Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Allows setting and getting options for the RoboSapiens instance. It merges user-provided options with default settings, including callbacks for various events like each match, no match, filtering, and completion. ```javascript {key:"opt",set:function(e){this._opt=a({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:function(){},noMatch:function(){},filter:function(){return!0},done:function(){},debug:!1,log:window.console},e)},get:function(){return this._opt}} ``` -------------------------------- ### Fill Multiline Text Field Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Fills a multiline text field in a window with the provided content. This is useful for fields that accept multiple lines of text. ```Robot Framework Fill Multiline Text Field A long text. With two sentences. ``` -------------------------------- ### Fill Text Field with '@' Locator Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Fills a text field identified using the '@' locator, typically used when the label is above the text field. ```Robot Framework Fill Text Field @ label content ``` -------------------------------- ### Fill Text Field with Label Example Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Fills a text field that has a label to its left. The 'exact' parameter defaults to True, ensuring an exact match for the label. ```Robot Framework Fill Text Field label content ``` -------------------------------- ### Get Window Text Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Retrieves the text content of the currently active window. Use this when you need to extract text from a window for verification or further processing. ```Robot Framework ${text} Get Window Text ``` -------------------------------- ### Path Expression Handling Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Processes path expressions, adding depth, getting context, and looking up values on the context or block parameters. Handles strict and falsy options. ```javascript PathExpression:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0],r=tW.default.helpers.scopedId(e),n=!e.depth&&!r&&this.blockParamIndex(t);n?this.opcode("lookupBlockParam",n,e.parts):t?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,r):this.opcode("pushContext")} ``` -------------------------------- ### Login to SAP Server Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Basic steps to open SAP, connect to a server, and log in using provided credentials. Ensure the SAP GUI executable path is correctly configured. ```Robot Framework Open SAP C:${/}Program Files (x86)${/}SAP${/}FrontEnd${/}SAPgui${/}saplogon.exe Connect to Server My Test Server Fill Text Field User TESTUSER Fill Text Field Password TESTPASSWORD Push Button Enter ``` -------------------------------- ### Get Block Parameter Index Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Determines the index of a block parameter given its name. ```javascript for(var t=0,r=this.options.blockParams.length;t=0)return[t,o]} ``` -------------------------------- ### Preamble and Context Creation Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Initializes the compiler's source and decorators, and creates the function context for compilation. Sets up necessary variables and aliases. ```javascript preamble:function(){this.lastContext=0,this.source=new t4.default(this.options.srcName),this.decorators=new t4.default(this.options.srcName)},createFunctionContext:function(e){var t=this,r="",n=this.stackVars.concat(this.registers.list);n.length>0&&(r+=", "+n.join(", "));var o=0;Object.keys(this.aliases).forEach(function(e){var n=t.aliases[e];n.children&&n.referenceCount>1&&(r+=", alias"+ ++o+"="+e,n.children[0]="alias"+o)});this.lookupPropertyFunctionIsUsed&&(r+=", "+this.lookup} ``` -------------------------------- ### Get Row Count Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Count the rows in a table. Allows specifying which table to count rows from. ```APIDOC ## Get Row Count ### Description Count the rows in a table. ### Method Not applicable (SDK function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **table_number** (integer) - Specify which table: 1, 2, ... Defaults to 1. ### Request Example ``` ${row_count} Get Row Count ``` ### Response #### Success Response (200) - **row_count** (integer) - The number of rows in the specified table. #### Response Example ```json { "row_count": 10 } ``` ``` -------------------------------- ### Check Ranges Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Validates and sorts an array of range objects based on start and end points. ```javascript checkRanges:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var r=[],n=0;return e.sort(function(e,t){return e.start-t.start}).forEach(function(e){var o=t.callNoMatchOnInvalidRanges(e,n),i=o.start,a=o.end;o.valid&&(e.start=i,e.length=a-i,r.push(e),n=a)}),r} ``` -------------------------------- ### Read Text by Substring Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Reads text that starts with a given substring. This is useful for dynamic text content. ```Python ${text} Read Text = substring ``` -------------------------------- ### Handlebars Environment Initialization Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Initializes a Handlebars environment, setting up helpers, safe strings, exceptions, and utilities. This is the main entry point for Handlebars. ```javascript function tg() { var e = new te.HandlebarsEnvironment; return ti.extend(e, te), e.SafeString = tn.default, e.Exception = to.default, e.Utils = ti, e.escapeExpression = ti.escapeExpression, e.VM = tp, e.template = function(t) { return tp.template(t, e) }, e } ``` -------------------------------- ### Get Separated Keywords Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Splits a string into an array of keywords, either by spaces or by individual words, and sorts them by length. ```javascript getSeparatedKeywords:function(e){var t=this,r=[];return e.forEach(function(e){t.opt.separateWordSearch?e.split(" ").forEach(function(e){e.trim()&&-1===r.indexOf(e)&&r.push(e)}):e.trim()&&-1===r.indexOf(e)&&r.push(e)}),{keywords:r.sort(function(e,t){return t.length-e.length}),length:r.length}} ``` -------------------------------- ### Setup Ignore Joiners Regular Expression Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Modifies the regex pattern to correctly handle ignored joiners and punctuation. ```javascript setupIgnoreJoinersRegExp:function(e){return e.replace(/[\[^(\|)\]]/g,function(e,t,r){var n=r.charAt(t+1);return/[[\]|\)]/.test(n)||""===n?e:e+"\\u0000"})} ``` -------------------------------- ### Open SAP Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Opens SAP GUI or SAP Business Client. It allows specifying the executable path and optional command-line arguments for customized startup behavior. ```APIDOC ## Open SAP ### Description Open SAP GUI or SAP Business Client. ### Method Not specified (assumed to be a library function call) ### Endpoint Not applicable (library function) ### Parameters #### Path Parameters - **path** (string) - Required - The path of the SAP executable. - **sap_args** (string) - Optional - Defaults to None. Command line arguments for the SAP executable. ### Request Example ``` Open SAP path Open SAP C:\\Program Files (x86)\\SAP\\FrontEnd\\SAPgui\\saplogon.exe Open SAP C:\\Program Files\\SAP\\FrontEnd\\SAPgui\\sapshcut.exe -sysname=XXX -client=NNN -user=%{username} -pw=%{password} ``` ### Response #### Success Response No specific response fields mentioned, operation is likely void. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Get Window Title Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Retrieves the title of the currently active window. This can be used to verify which SAP window is currently in focus. ```APIDOC ## Get Window Title ### Description Get the title of the currently active window. ### Method Not specified (assumed to be a library function call) ### Endpoint Not applicable (library function) ### Parameters None ### Request Example ``` ${title} Get Window Title ``` ### Response #### Success Response - **title** (string) - The title of the active window. #### Response Example ```json { "title": "SAP GUI Window" } ``` ``` -------------------------------- ### Prepare Raw Block Statement Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Initializes a Program object and returns a BlockStatement. It ensures the program's location information is correctly set. ```javascript er=function(e,t,r,n){tH(e,r);var o={type:"Program",body:t,strip:{},loc:n=this.locInfo(n)};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:o,openStrip:{},inverseStrip:{},closeStrip:{},loc:n}} ``` -------------------------------- ### RoboSAPiens Initialization Arguments Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Describes the arguments available during the initialization of the RoboSAPiens library. Use 'presenter_mode' to highlight GUI elements and 'x64' for 64-bit automation. ```python RoboSAPiens(presenter_mode=True, x64=True) ``` -------------------------------- ### Read Dropdown Menu Entry Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Reads the current entry from a specified dropdown menu. Use this to get the selected item in a dropdown. ```Python ${entry} Read Dropdown Menu Entry locator ``` -------------------------------- ### Build RoboSapiens Wheel Source: https://github.com/imbus/robotframework-robosapiens/blob/main/README.md Build the wheel for RoboSapiens using the 'just' build tool. This is typically used by developers. ```bash just build ``` -------------------------------- ### Initialize SourceMapGenerator Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Initializes a new SourceMapGenerator instance. Options can include 'file', 'sourceRoot', and 'skipValidation'. ```javascript function SourceMapGenerator(e) { e || (e = {}) this._file = i.getArg(e, "file", null) this._sourceRoot = i.getArg(e, "sourceRoot", null) this._skipValidation = i.getArg(e, "skipValidation", !1) this._sources = new a this._names = new a this._mappings = new s this._sourcesContents = null } ``` -------------------------------- ### RoboSAPiens Initialization Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Initializes the RoboSAPiens library. It supports optional arguments for presenter mode and 64-bit execution. ```APIDOC ## RoboSAPiens Initialization ### Description Initializes the RoboSAPiens library with optional arguments. ### Arguments - **presenter_mode** (boolean) - Optional - If true, waits half a second after executing a keyword and highlights the GUI element acted upon. - **x64** (boolean) - Optional - If true, executes RoboSAPiens in 64-bit mode to automate SAP GUI 8 64-bit or SAP Business Client. ### Example ```robotframework RoboSAPiens(presenter_mode=True, x64=True) ``` ``` -------------------------------- ### Source Map and String Representation Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Provides methods to get the source code with or without its source map. Useful for debugging and code inspection. ```javascript toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}} ``` -------------------------------- ### Initialize RoboSapiens Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Creates a new instance of RoboSapiens with specified options. The 'opt' object allows customization of various search and marking behaviors. ```javascript var ef = function(e) { var t = this, r = new l(e); return this.mark = function(e, n) { return r.mark(e, n), t }, this.markRegExp = function(e, n) { return r.markRegExp(e, n), t }, this.markRanges = function(e, n) { return r.markRanges(e, n), t }, this.unmark = function(e) { return r.unmark(e), t } }; var eg = {}; ``` -------------------------------- ### Get text nodes Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Iterates through text nodes in the DOM, collecting their content and positions. Used for processing text across multiple nodes. ```javascript function(e){var t=this,r="",n=\[\];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(e){n.push({start:r.length,end:(r+=e.textContent).length,node:e})},function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){e({value:r,nodes:n})})} ``` -------------------------------- ### Connect to Server Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Connects to the SAP server using the provided connection name from SAP Logon. Returns session information. ```APIDOC ## Connect to Server ### Description Connects to the SAP server using the provided connection name. ### Parameters - **server_name** (string) - Required - The name of the connection in SAP Logon (not the SID). ### Return Value Contains session information such as client number and system ID. ### Example ```robotframework Connect to Server server_name ``` ``` -------------------------------- ### Close SAP Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Closes the SAP GUI and terminates its process. This keyword is intended to be used after starting SAP GUI with the 'Open SAP' keyword. ```APIDOC ## Close SAP ### Description Closes the SAP GUI and terminates its process. ### Note This keyword only works if SAP GUI was started with the keyword 'Open SAP'. ### Example ```robotframework Close SAP ``` ``` -------------------------------- ### Connect to Running SAP Session (Default) Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Connects to an already running SAP instance, defaulting to session number 1. ```robotframework Connect to Running SAP ``` -------------------------------- ### Handlebars Scoped ID Check Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Determines if an identifier is scoped, typically starting with '.' or 'this'. Used for resolving variables within the Handlebars context. ```javascript scopedId: function(e) { return /^\.|this\b/.test(e.original) } ``` -------------------------------- ### Select Tab Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Selects a tab by its name or tooltip. Ensure the tab name or tooltip is correctly provided. ```Robot Framework Select Tab tab_name ``` -------------------------------- ### Get Window Text Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Retrieves the text content of the currently active window. This function is useful for extracting information displayed in SAP GUI elements. ```APIDOC ## Get Window Text ### Description Get the text message of the currently active window. ### Method Not specified (assumed to be a library function call) ### Endpoint Not applicable (library function) ### Parameters None ### Request Example ``` ${text} Get Window Text ``` ### Response #### Success Response - **text** (string) - The text content of the active window. #### Response Example ```json { "text": "Example Window Text" } ``` ``` -------------------------------- ### Connect to SAP Server Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Establishes a connection to the SAP server using the provided connection name from SAP Logon. The return value includes session details like client number and system ID. ```robotframework Connect to Server server_name ``` -------------------------------- ### Run Robot Framework with Listener Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Execute Robot Framework tests with the custom listener enabled. The '-P .' flag ensures the listener can be found in the current directory. ```Shell robot -P . --listener Listener test.robot ``` -------------------------------- ### Invoke Known Helper Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Sets up a known helper and invokes it with specified parameters. Used for calling predefined helper functions. ```javascript invokeKnownHelper:function(e,t){var r=this.setupHelper(e,t) this.push(this.source.functionCall(r.name,"call",r.callParams))} ``` -------------------------------- ### Check and Validate Ranges Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Validates an array of range objects, ensuring they are properly formatted and non-overlapping. It sorts ranges by start position and logs invalid ranges. ```javascript var ranges = [ { start: 10, length: 5 }, { start: 20, length: 10 } ]; console.log(gExp.checkRanges(ranges)); ``` -------------------------------- ### Connect to Running SAP Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Connects to an already running SAP instance and takes control of it. It allows specifying session number, connection name, and client number. ```APIDOC ## Connect to Running SAP ### Description Connects to an already running SAP instance and takes control of it. ### Parameters - **session_number** (integer) - Optional - The session number shown in the upper right or lower right corner of the window. Defaults to 1 if not specified. - **connection** (string) - Optional - The name of the connection in SAP Logon. - **client** (string) - Optional - The three-digit number of the client. ### Return Value Contains session information such as client number, system ID, and session number. ### Examples ```robotframework Connect to Running SAP Connect to Running SAP session_number=N Connect to Running SAP connection=Test Connection session_number=N Connect to Running SAP connection=Test Connection client=NNN ``` ``` -------------------------------- ### Match Existing Program Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Matches a program node against existing compiled programs in the context. Used to avoid recompiling identical programs. ```javascript matchExistingProgram:function(e){for(var t=0,r=this.context.environments.length;t20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var e,t,r,n,o,i=this._currentRules(),a=0;at[0].length)||(t=r,n=a,this.options.flex));a++);return t?(o=t[0].match(/(?:\r\n?|\n).*\n/g))&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)?e:void 0:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()}, _currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}}).options={},e.performAction=function(e,t,r,n){function o(e,r){return t.yytext=t.yytext.substring(e,t.yyleng-r+e)}switch(r){case 0:if("\\\\"===t.yytext.slice(-2)?(o(0,1),this.begin("mu")):"\\ ``` -------------------------------- ### Handle Hash Parameters Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Handles hash parameters by pushing and assigning key-value pairs to the hash. It also handles empty hashes. ```javascript var t=e.pairs,r=0,n=t.length;for(this.opcode("pushHash");r>' to specify the target text field label. ```Robot Framework Fill Text Field unique label >> text field label content ``` -------------------------------- ### Export Window Contents Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Exports window contents to a JSON file and saves a PNG screenshot. The output files are named using the provided 'name' and saved to the specified 'directory'. Backslashes in the directory path must be escaped, or use the ${/} path separator. ```Robot Framework Export Window name directory ``` -------------------------------- ### Handle Simple Sexpression Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Handles simple Sexpressions by accepting the path and resolving potential lambdas. Ensures strict mode is enabled for the path. ```javascript var t=e.path;t.strict=!0,this.accept(t),this.opcode("resolvePossibleLambda")} ``` -------------------------------- ### Press Key Combination Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Presses a specified key combination. This can be a single key or multiple keys separated by '+'. It supports keyboard shortcuts found in SAP GUI context menus and provides a link to the official SAP GUI documentation for a full list of combinations. Pressing F2 is equivalent to a double-click. ```APIDOC ## Press Key Combination ### Description Presses the given key combination. This function supports single keys or key combinations separated by a '+' sign. It is useful for triggering keyboard shortcuts within the SAP GUI. ### Method Not Applicable (SDK Function) ### Parameters #### Arguments - **key_combination** (string) - Required - Either one key or several keys separated by a + sign. - **table_number** (integer) - Optional - The table (1, 2, ...) that should receive the key press. ### Examples ``` Press Key Combination key_combination ``` ### Notes Consult the [documentation of SAP GUI](https://help.sap.com/docs/sap_gui_for_windows/b47d018c3b9b45e897faf66a6c0885a8/71d8c95e9c7947ffa197523a232d8143.html?locale=en-US) for a full list of supported key combinations. Pressing F2 is equivalent to a double-click. ``` -------------------------------- ### Initializing RoboSapiens Instance Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Creates a new instance of RoboSapiens, which can then be used to mark or unmark text. The constructor takes a DOM element as an argument to specify the context for operations. ```javascript e}(),ef=function(e){var t=this,r=new l(e);return this.mark=function(e,n){return r.mark(e,n),t},this.markRegExp=function(e,n){return r.markRegExp(e,n),t},this.markRanges=function(e,n){return r.markRanges(e,n),t},this.unmark=function(e){return r.unmark(e),t},t} ``` -------------------------------- ### Get Page ID by Title Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Retrieves the unique ID of a browser page based on its title. This is useful for identifying and switching to specific pages within an automated browser session. ```Robot Framework Get Page Id by Title [Arguments] ${title} ${browsers} Get Browser Catalog ${contexts} Set Variable ${browsers}[0][contexts] ${pages} Set Variable ${contexts}[0][pages] FOR ${page} IN @{pages} IF '${page}[title]' == '${title}' Return From Keyword ${page}[id] END END Fail The page '${title}' is not open in the current browser. ``` -------------------------------- ### Wrap range from index Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Wraps specified ranges within text nodes based on start and end indices. It checks for whitespace ranges and applies filtering and callbacks for each wrapped range. ```javascript function(e,t,r,n){var o=this;this.getTextNodes(function(i){var a=i.value.length;e.forEach(function(e,n){var s=o.checkWhitespaceRanges(e,a,i.value),l=s.start,c=s.end;s.valid&&o.wrapRangeInMappedTextNode(i,l,c,function(r){return t(r,e,i.value.substring(l,c),n)},function(t){r(t,e)})}),n()})} ``` -------------------------------- ### Prepare Block Statement Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Handles the creation of BlockStatement or DecoratorBlock objects. It manages program and inverse program bodies, including chained blocks and strip flags. ```javascript en=function(e,t,r,n,o,i){n&&n.path&&tH(e,n);var a=/\*/.test(e.open);t.blockParams=e.blockParams;var s=void 0,l=void 0;if(r){if(a)throw new t$.default("Unexpected inverse block on decorator",r);r.chain&&(r.program.body[0].closeStrip=n.strip),l=r.strip,s=r.program}return o&&(o=s,s=t,t=o),{type:a?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:s,openStrip:e.strip,inverseStrip:l,closeStrip:n&&n.strip,loc:this.locInfo(i)}} ``` -------------------------------- ### Connect to Browser for Embedded Controls Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Connects to a browser instance using Browser Library, enabling automation of embedded controls. Requires CDP (Chrome DevTools Protocol) to be enabled. ```Robot Framework Connect To Browser http://localhost:4711 chromium use_cdp=True ``` -------------------------------- ### SourceMapConsumer Initialization Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Provides a constructor for SourceMapConsumer, handling both string and object inputs for source map data. ```javascript function c(e,t){var r=e;return"string"==typeof e&&(r=o.parseSourceMapInput(e)),null!=r.sections?new p(r,t):new u(r,t)} ``` -------------------------------- ### Press Key Combination Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Presses a specified key combination. Consult SAP GUI documentation for a full list of supported key combinations. Pressing F2 is equivalent to a double-click. ```robotframework Press Key Combination key_combination ``` -------------------------------- ### Wrap a Range in a New Text Node Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Splits a text node at specified start and end points and wraps the content between them in a new element (defaulting to 'mark'). Attributes like 'data-markjs' and 'class' can be added. ```javascript var textNode = document.createTextNode('This is a sample text.'); var parent = textNode.parentNode; parent.insertBefore(textNode, null); var newElement = gExp.wrapRangeInTextNode(textNode.textContent, 5, 11); console.log(newElement); ``` -------------------------------- ### Handle Invalid Ranges Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Internal function to process potentially invalid range objects. It parses start and length, checks for numeric validity and positive range, and logs issues if the range is invalid or overlaps. ```javascript var range = { start: 5, length: 10 }; console.log(gExp.callNoMatchOnInvalidRanges(range, 0)); ``` -------------------------------- ### Screenshot on Keyword Failure Listener Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Implement a Robot Framework listener to automatically capture a screenshot when a RoboSAPiens keyword fails. This helps in debugging by providing visual context of the failure. ```Python from robot.api.interfaces import ListenerV3 from robot.libraries.BuiltIn import BuiltIn class Listener(ListenerV3): def end_library_keyword(self, data, implementation, result): library = 'RoboSAPiens' if result.failed and implementation.full_name.startswith(library): robosapiens = BuiltIn().get_library_instance(library) robosapiens.save_screenshot('LOG') ``` -------------------------------- ### Get Separated Keywords for Search Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Processes an array of strings to extract unique keywords. If 'separateWordSearch' is enabled, it splits strings by spaces; otherwise, it treats each string as a keyword. Keywords are sorted by length in descending order. ```javascript var keywords = [ "Robot Framework", "Test Automation" ]; gExp.opt.separateWordSearch = true; console.log(gExp.getSeparatedKeywords(keywords)); gExp.opt.separateWordSearch = false; console.log(gExp.getSeparatedKeywords(keywords)); ``` -------------------------------- ### Handle Helper Sexpression Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Handles helper Sexpressions by setting up parameters, and invoking either a known helper or an unknown helper. It uses strict mode and falsy flags for the path. ```javascript var n=this.setupFullMustacheParams(e,t,r),o=e.path,i=o.parts[0];if(this.options.knownHelpers[i])this.opcode("invokeKnownHelper",n.length,i);else if(this.options.knownHelpersOnly)throw new tG.default("You specified knownHelpersOnly, but used the unknown helper "+i,e);else o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",n.length,o.original,tW.default.helpers.simpleId(o))} ``` -------------------------------- ### Prepare Partial Block Statement Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Constructs a PartialBlockStatement, used for partial template inclusions within blocks. It includes the partial name, parameters, hash, and associated program. ```javascript ei=function(e,t,r,n){tH(e,r),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:r&&r.strip,loc:this.locInfo(n)}} ``` -------------------------------- ### Extract Text Nodes with Positions Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Traverses the DOM to find all text nodes within a specified element. It returns the concatenated text content and an array of objects, each containing the start and end position of a text node within the concatenated string. ```javascript gExp.getTextNodes(function(result) { console.log("Full Text:", result.value); console.log("Text Nodes:", result.nodes); }); ``` -------------------------------- ### Connect to Running SAP Session (Specific Session) Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Connects to a specific running SAP session by providing the session number. ```robotframework Connect to Running SAP session_number=N ``` -------------------------------- ### Handle Pop-up Window After Button Click Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html A keyword to detect and close a pop-up window if its title matches the expected title after a button click. It logs the pop-up and saves a screenshot before closing. ```Robot Framework Click button and close pop-up window [Arguments] ${button} ${title} ${close button} Push Button ${button} ${window_title} Get Window Title IF $window_title == $title Log Pop-up window: ${title} Save screenshot LOG Push button ${close button} END ``` -------------------------------- ### Handlebars Environment Creation Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Creates a new Handlebars environment with default settings. This is a foundational step for using Handlebars functionalities. ```javascript var tm = tg(); tm.create = tg; tf.default(tm); tm.default = tm; ev.default = tm; ``` -------------------------------- ### Export Window Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Exports the contents of the current SAP GUI window to a JSON file and automatically saves a screenshot in PNG format. The output files are named using the provided 'name' and saved to the specified 'directory'. Note that not all GUI elements are currently exported. ```APIDOC ## Export Window name directory ### Description Export the window contents to a JSON file. A screenshot will automatically be saved in PNG format. ### Method Not applicable (SDK function) ### Parameters #### Path Parameters - **name** (string) - Required - Name of the output files - **directory** (string) - Required - Absolute path to the directory where the files will be saved ### Request Example ``` Export Window name directory ``` ### Response #### Success Response This function does not return a value. ### Hint Backslashes must be written twice. Otherwise use the RF built-in variable ${/} as path separator. ### Note Currently not all GUI elements are exported. ``` -------------------------------- ### Set Source Content Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Sets the content for a specific source file. If content is null, it removes the content for that file. ```javascript l.prototype.setSourceContent = function(e, t) { var r = e null != this._sourceRoot && (r = i.relative(this._sourceRoot, r)) null != t ? (this._sourcesContents || (this._sourcesContents = Object.create(null)), this._sourcesContents[i.toSetString(r)] = t) : this._sourcesContents && (delete this._sourcesContents[i.toSetString(r)], 0 === Object.keys(this._sourcesContents).length && (this._sourcesContents = null)) } ``` -------------------------------- ### Accept AST Node Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.DE.html Accepts an AST node and processes it using the visitor pattern. This is a core method for traversing and transforming the AST. ```javascript tU=function(e,t){var r=tq(e,t);return new tD.default(t).accept(r)} ``` -------------------------------- ### RoboSapiens IE Constructor Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Initializes a RoboSapiens instance, detecting and handling Internet Explorer specific behaviors. ```javascript var l = function() { function e(t) { o(this, e), this.ctx = t, this.ie = !1; var r = window.navigator.userAgent; (r.indexOf("MSIE") > -1 || r.indexOf("Trident") > -1) && (this.ie = !0) } return i(e, [{ key: "log", value: function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "de" } }]), e }() ``` -------------------------------- ### Push Source Source: https://github.com/imbus/robotframework-robosapiens/blob/main/docs/RoboSAPiens.html Pushes content onto the source buffer. If there is pending content, it is appended to the buffer before pushing the new content. ```javascript pushSource:function(e){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0) e&&this.source.push(e)} ```