{"id":19152402,"url":"https://github.com/neooblaster/-testcomplete-keyboard","last_synced_at":"2026-06-18T22:31:42.802Z","repository":{"id":57165631,"uuid":"492836259","full_name":"neooblaster/-testcomplete-Keyboard","owner":"neooblaster","description":"An interface to perform Keyboard (and some Mouse) actions in an easier way","archived":false,"fork":false,"pushed_at":"2022-05-16T13:03:34.000Z","size":214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-26T06:03:47.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neooblaster.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-16T12:58:50.000Z","updated_at":"2022-05-16T13:01:03.000Z","dependencies_parsed_at":"2022-08-30T15:21:09.923Z","dependency_job_id":null,"html_url":"https://github.com/neooblaster/-testcomplete-Keyboard","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-Keyboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-Keyboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-Keyboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-Keyboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neooblaster","download_url":"https://codeload.github.com/neooblaster/-testcomplete-Keyboard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240236361,"owners_count":19769580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T08:17:39.561Z","updated_at":"2026-06-14T17:30:21.422Z","avatar_url":"https://github.com/neooblaster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TestComplete - Keyboard Interface\r\n\r\n\u003e An interface to perform Keyboard (and some Mouse) actions in an easier way.\r\n\r\n* **Version** : ``v0.6.2``\r\n* **Compatibility** : **TestComplete** only\r\n* **Script** : ``./node_modules/@testcomplete/keyboard/Keyboard.js``\r\n* **Dependencies** :\r\n    * none\r\n\r\n\r\n## Summary\r\n\r\n[](BeginSummary)\r\n* [Summary](#summary)\r\n* [Keyboard Setup for TestComplete](#keyboard-setup-for-testcomplete)\r\n* [Get Started](#get-started)\r\n* [Detailed Documentation](#detailed-documentation)\r\n    * [Method ``on()``](#method-on)\r\n    * [Method ``keys()``](#method-keys)\r\n    * [method ``run()``](#method-run)\r\n    * [method ``send()``](#method-send)\r\n    * [Method ``delay()``](#method-delay)\r\n    * [Method ``wait()``](#method-wait)\r\n    * [Method ``refresh()``](#method-refresh)\r\n    * [Method ``autorefresh()``](#method-autorefresh)\r\n    * [Method ``keysautoclear()``](#method-keysautoclear)\r\n    * [Method ``setFocus()``](#method-setfocus)\r\n    * [Method ``function()``](#method-function)\r\n    * [Method ``get()``](#method-get)\r\n* [Cheat Sheet ``Keyboard``](#cheat-sheet-keyboard)\r\n    * [Top of Methods](#top-of-methods)\r\n        * [Method ``on()``](#method-on)\r\n        * [Method ``keys()``](#method-keys)\r\n        * [method ``run()``](#method-run)\r\n        * [method ``send()``](#method-send)\r\n        * [Method ``delay()``](#method-delay)\r\n        * [Method ``wait()``](#method-wait)\r\n        * [Method ``refresh()``](#method-refresh)\r\n        * [Method ``autorefresh()``](#method-autorefresh)\r\n        * [Method ``keysautoclear()``](#method-keysautoclear)\r\n        * [Method ``setFocus()``](#method-setfocus)\r\n        * [Method ``function()``](#method-function)\r\n        * [Method ``get()``](#method-get)\r\n* [List of all methods](#list-of-all-methods)\r\n[](EndSummary)\r\n\r\n\r\n\r\n## Keyboard Setup for TestComplete\r\n\r\nAs this library is published on **npmjs**,\r\nyou can easily get library with the following command\r\nif you have **nodejs** installed on your computer.\r\n\r\n````bash\r\nnpm install @testcomplete/keyboard\r\n````\r\n\r\nPlease confer to this documentation to add script in TestComplete :\r\n\r\nScript List for the setup :\r\n\r\n* ``./node_modules/@testcomplete/keyboard/Keyboard.js``\r\n\r\n[@testcomplete/testcompletelibrarysetup](https://www.npmjs.com/package/@testcomplete/testcompletelibrarysetup)\r\n\r\n\r\n\r\n## Get Started\r\n\r\nDuring our developments, we encountered many situations where\r\nnavigation thanks to the keyboard highly help us for automation.\r\n\r\nTo increase code readability where keyboard is used and simplify writing, \r\nI choose to create a **Keyboard** interface which allow recording instructions\r\nsequences from methods (name) standing for the keyboard key.\r\nYou can enter text sequence as like TestComplete standard one (`Keys()`) as well.\r\n\r\nSome methods accept a **key** as parameter to produce a combination key as like **CTRL+F** (`.ctrl('f')`).\r\n\r\nPlease find below the exhaustive list of generated methods for keys\r\n\r\n| Method | Combining | Keys | │ | Method | Combining | Keys |\r\n|---|:---:|:---:|:---:|---|:---:|:---:|\r\n| ctrl | True | CTRL | │ | win | False | Windows |\r\n| shift | True | SHIFT | │ | pause | False | Pause |\r\n| alt | True | ALT | │ | pageUp | False | Page Up |\r\n| appsKey | False | Apps Key | │ | pageDown | False | Page Down |\r\n| bs | False | Backspace | │ | prtsc | False | Print Screen |\r\n| backspace | False | Backspace | │ | print | False | Print Screen |\r\n| caps | False | Caps Lock | │ | printScreen | False | Print Screen |\r\n| clear | False | Delete | │ | scrollLock | False | Scroll Lock|\r\n| del | False | Delete | │ | sl | False | Scroll Lock |\r\n| delete | False | Delete | │ | slock | False | Scroll Lock |\r\n| down | False | Down | │ | numPlus | False | Numeric Plus (+) |\r\n| end | False | End | │ | nump | False | Numeric Plus (+) |\r\n| enter | False | Enter | │ | numMinus | False | Numeric Minus (-) |\r\n| esc | False | Escape | │ | numm | False | Numeric Minus (-) |\r\n| escape | False | Escape | │ | numLock | False | Numeric Lock |\r\n| home | False | Home | │ | numl | False | Numeric Lock |\r\n| ins | False | Insert | │ | numAsterisk | False | Numeric Asterisk |\r\n| insert | False | Insert | │ | numa | False | Numeric Asterisk |\r\n| left | False | Left | │ | numSlash | False | Numeric Slash |\r\n| right | False | Right | │ | nums | False | Numeric Slash |\r\n| up | False | Up | │ | space | False | Space |\r\n| tab | False | Tabulation | │ | F1 | False | Function Key F1 |\r\n| F2 | False | Function Key F2 | │ | F3 | False | Function Key F3 |\r\n| F4 | False | Function Key F4 | │ | F5 | False | Function Key F5 |\r\n| F6 | False | Function Key F6 | │ | F7 | False | Function Key F7 |\r\n| F8 | False | Function Key F8 | │ | F9 | False | Function Key F9 |\r\n| F10 | False | Function Key F10 | │ | F11 | False | Function Key F11 |\r\n| F12 | False | Function Key F12 | │ | f1 | False | Function Key F1 |\r\n| f2 | False | Function Key F2 | │ | f3 | False | Function Key F3 |\r\n| f4 | False | Function Key F4 | │ | f5 | False | Function Key F5 |\r\n| f6 | False | Function Key F6 | │ | f7 | False | Function Key F7 |\r\n| f8 | False | Function Key F8 | │ | f9 | False | Function Key F9 |\r\n| f10 | False | Function Key F10 | │ | f11 | False | Function Key F11 |\r\n| f12 | False | Function Key F12 | │ |  |  |  |\r\n| keys | True | TestComplete Keys() Method | │ | click | False | Mouse Click |\r\n| clickM | False | Mouse Middle Click | │ | clickR | False | Mouse Right Click |\r\n| dblClick | False | Mouse Double Click | │ | dblClickM | False | Mouse Double Middle Click |\r\n| dblclickR | False | Mouse Double Right Click | │ | drag | False | Mouse Drag |\r\n| dragM | False | Mouse Middle Button Drag | │ | dragR | False | Mouse Right Button Drag |\r\n| hoverMouse | False | SAPLOGON Specific Mouse Hover | │ | mouseWheel | False | SAPLOGON Specific Scrolling |\r\n| press | False | SAPLOGON Specific Press event | │ | setFocus | False | SAPLOGON Specific set focus on field |\r\n| wait | False | Wait specified delay | │ | refresh | False | Refresh NameMapped object |\r\n| autoRefresh | False | Enable/Disable autorefresh | │ | function | False | Executes provided function |\r\n\r\nAll here before methods mentioned can be called from loaded ``Keyboard`` interface\r\nwith following statement and main definition is (methods are case sensitive) :\r\n\r\n\u003e Keyboard \u003cmethod\u003e( [ String $sKey, [ Number $nDelayMs ] ] | [ Number $nDelayMs ] )\r\n\r\nBefore calling keys methods, you have at least call the method ``.on()``\r\nto set TestComplete NameMapping Object which will receive inputs.\r\n\r\nAll keys methods called next to method ``.on()`` will refer to previously \r\nobject set. You can change the TestComplete NM Object by calling method\r\n``.on()`` at any time. \r\n\r\n````js\r\nconst Keyboard = require('Keyboard');\r\n\r\nlet kb = Keyboard.on(Aliases.browser.BrowserWindow).ctrl('f').enter().escape().right();\r\n````\r\n\r\nAll methods have a last optional argument ``$nDelayMs`` to set the\r\ndelay time to wait at the end of the sequence. It's concerns only the \r\nsequence which is currently registering.\r\n\r\n````js\r\n// For Method accepting key :\r\nKeyboard.ctrl('f', 1000);   // Press CTRL+F \u0026 Wait 1000ms\r\n\r\n// For Method which stand for direct intput\r\nKeyboard.enter(2000);       // Press Enter \u0026 Wait 2000ms\r\n````\r\n\r\nFrom this point, you can run sequence thanks to method ``run()`` (Alias `send()`);\r\n\r\n\r\n\r\n\r\n\r\n\r\n## Detailed Documentation\r\n\r\n\r\n### Method ``on()``\r\n\r\n\u003e Keyboard on( Object $oTestCompleteAlias )\r\n\r\nThis method store the TestComplete object which will received keys sequences\r\nrecorded in its own method ``Keys()``.\r\n\r\nIt can be set at anytime, before the call of method ``run()`` (Alias `send()`);\r\n\r\n\r\n\r\n### Method ``keys()``\r\n\r\n\u003e Keyboard keys( String $sKeys, [ Number $nDelayMs] )\r\n\r\nThe ``Keyboard`` method `keys()` works like the TestComplete standard one and\r\naccept any sequence which respect the following documentation :\r\n[Keys Method](https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-sys-desktop-pda/keys-method-sys-desktop-object.html)\r\n\r\n\r\n````js\r\nKeyboard.keys('[Hold]^f[Release]MySearchWord').run();\r\n// Will produce the same result as :\r\nKeyboard.ctrl('f').keys('MySearchWord').run();\r\n````\r\n\r\nYou can passe in extra parameter the delay you want to apply\r\nonly for this sequence by filling ``$nDelayMs`` where the delay \r\nis in milliseconds.\r\n\r\n\r\n\r\n### method ``run()``\r\n\r\n\u003e Keyboard run( [ Boolean $bClearSequence = true ] )\r\n\r\nThis method call method ``Keys()`` of the provided **TestComplete**\r\nobject set by ``on()``.\r\nIf object is not defined or if it does not have method ``Keys()``,\r\nan error is logged with ``Error`` level and returns `false` .\r\n\r\nAs method ``run()`` return `Keyboard` interface, you can :\r\n\r\n- Re-execute the sequence if ``run()`` has been call with flag\r\n`$bClearSequence = false` and or append new sequences.\r\n- Record a new sequence and execute it\r\n\r\n\r\n\r\n### method ``send()``\r\n\r\n\u003e Keyboard send( [ Boolean $bClearSequence = true ] )\r\n\r\nThis method is an alias of method ``run()``.\r\n\r\nConfer to chapter **Method ``run())``**.\r\n\r\n\r\n\r\n### Method ``delay()``\r\n\r\n\u003e Keyboard delay( [ Number $dDelayMs = 100 ] )\r\n\r\nEach sequence recorded thanks to keyboard key methods\r\nmake a pause delay. \r\n\r\nThe default delay set \u0026 used while the sequence is recorded is ``100ms``.\r\n\r\nYou can change delay value at anytime. The new delay is used for all next\r\nrecorded sequences until you change the value again.\r\n\r\nExample : \r\n````js\r\nKeyboard.ctrl('f').keys('MySearchWord').delay(1000).enter().left().run();\r\n// Result :\r\n// Press CTLR+F and wait 100ms\r\n// Type MySearchWord and wait 100ms\r\n// Set the delay to 1000ms (from this point, all next sequences will wait for 1000ms)\r\n// Press Enter and wait 1000ms\r\n// Press left and wait 1000ms\r\n````\r\n\r\n\r\n\r\n### Method ``wait()``\r\n\r\n\u003e Keyboard wait( [ Number $dDelayMs = 100 ] )\r\n\r\nDo not mix up with method ``delay( )``.\r\nDelay allow you to set for all sequence a delay while ``wait``\r\nperform the delay action with the provided time in ms.\r\n\r\nExample : \r\n````js\r\nKeyboard.on(Aliases.sap.TCODE_LAUNCHER)\r\n    .keys('WE19')\r\n    .wait(2000)\r\n    .run();\r\n// Result :\r\n// In SAP, in TCODE Launcher,\r\n// Type WE19\r\n// Wait 2000 ms (2s)\r\n````\r\n\r\n\r\n\r\n### Method ``refresh()``\r\n\r\n\u003e Keyboard refresh(  )\r\n\r\nThis method allows you to force the Name Mapping refresh using\r\n``RefreshMappingInfo()``.\r\nIt's useful when element is regenerated implying the reference which no longer exist\r\neven if identifier still identical.\r\n\r\n**Important** : **Keyboard** automatically perform refresh before each action.\r\nBut it can be disabled globally and done manually with this method (``refresh``).\r\n\r\nExample : \r\n````js\r\nKeyboard.on(Aliases.browser.pageIndex.Login)\r\n    .click()\r\n    .refresh()\r\n    .click()\r\n    .run();\r\n// Result :\r\n// Click on the button 'Login'\r\n// Action will reload the page\r\n// Perform refresh on the last object set with .on() \r\n// Here : Aliases.browser.pageIndex.Login\r\n````\r\n\r\n\r\n\r\n### Method ``autorefresh()``\r\n\r\n\u003e Keyboard refresh( Number $nDelayMs, Boolean $bEnabled )\r\n\r\nBy default, **Keyboard** automatically perform refresh before each action.\r\nBut it can be disabled globally with this method and done manually with \r\nmethod (``refresh``).\r\n\r\n**Important** : Refreshing Name Mapping has a side effect which is\r\nthe focus is reset to default position.\r\nIf you encounter focus issue, please disable automatic refresh.\r\n\r\nExample : \r\n````js\r\nKeyboard\r\n    .autorefresh(0, false)\r\n    .on(Aliases.browser.pageIndex.Login)\r\n    .click()\r\n    .refresh()\r\n    .click()\r\n    .run();\r\n// Result :\r\n// Disable autorefresh globally\r\n// Click on the button 'Login'\r\n// Action will reload the page\r\n// Perform refresh on the last object set with .on() \r\n// Here : Aliases.browser.pageIndex.Login\r\n````\r\n\r\n\r\n\r\n### Method ``keysautoclear()``\r\n\r\n\u003e Keyboard keysautoclear( Number $nDelayMs, Boolean $bEnabled )\r\n\r\nBy default, **Keyboard** automatically perform `CTRL + A, Back Space`\r\nto clear input field before typing text requested with the method `keys()`.\r\n\r\nYou can turn off the autoclear for input fields.\r\n\r\nExample : \r\n````js\r\nKeyboard\r\n    .keysautoclear(false)\r\n    .run();\r\n// Result :\r\n// Disable auto clear globally\r\n````\r\n\r\n\r\n\r\n### Method ``setFocus()``\r\n\r\n\u003e Keyboard setFocus(  )\r\n\r\nThis method is a SAP Specific (via Addon).\r\nIt allows use to get focus for any element in SAP Logon.\r\n\r\nExample : \r\n````js\r\nKeyboard\r\n    .on(Aliases.sap.TCODE_LAUNCHER)\r\n    .setFcous()\r\n    .run();\r\n// Result :\r\n// Place cursor (blinking) in field TCODE (in SAP)\r\n````\r\n\r\n\r\n\r\n### Method ``function()``\r\n\r\n\u003e Keyboard function( Number $nDelayMs, Function $fFunction [, ...$args] )\r\n\r\nYou can call any function between two action registred with **Keyboard**.\r\n\r\nExample : Instead of splitting you code in two part, simply use method ``function()`` :\r\n\r\n````js\r\nlet LoadVariant_BySearch = require('LoadVariant_BySearch');\r\n\r\nKeyboard.on(Aliases.sap.TCODE_LAUNCHER)\r\n    .keys('ZME59N')\r\n    .enter()\r\n    .run();\r\n\r\nLoadVariant_BySearch('Variant');\r\n\r\nKeyboard.on(Aliases.sap.ZME59N.IN.PLANT_LOW)\r\n    .keys('S014')\r\n    .f8()\r\n    .run()\r\n````\r\n\r\nDo as following (readbility increased) :\r\n\r\n````js\r\nlet LoadVariant_BySearch = require('LoadVariant_BySearch');\r\n\r\nKeyboard.on(Aliases.sap.TCODE_LAUNCHER)\r\n    .keys('ZME59N')\r\n    .enter()\r\n    .function(0, LoadVariant_BySearch, 'Variant')\r\n    .on(Aliases.sap.ZME59N.IN.PLANT_LOW)\r\n    .keys('S014')\r\n    .f8()\r\n    .run()\r\n````\r\n\r\n\r\n\r\n### Method ``get()``\r\n\r\n\u003e Keyboard get( String $sProperty )\r\n\r\n**Keyboard** do much more than expected for a keyboard interface, but features\r\nare a huge help in TestComplete script writing.\r\n\r\n**Keyboard** allows you to retrieve a **TestComplete** property.\r\nBy using the method ``get()``, you will take advantage of **autorefresh**\r\nand the speed of the capability to retrieve Web Element very quickly using\r\nmicro interval.\r\n\r\nPrefer \r\n\r\n````js\r\nlet sText = Keyboard.on(Aliases.sap.ME22N.HEADER.ORGA_DATA.COMPANY_CODE).get('Text');\r\n````\r\n\r\nas \r\n\r\n````js\r\nlet sText = Aliases.sap.ME22N.HEADER.ORGA_DATA.COMPANY_CODE.Text;\r\n````\r\n\r\n\r\n\r\n\r\n\r\n\r\n## Cheat Sheet ``Keyboard``\r\n\r\n\u003e **Version** : v0.6.0\r\n\r\n\r\n### Top of Methods\r\n\r\n\r\n#### Method ``on()``\r\n\r\n\u003e Keyboard on( Object $oTestCompleteAlias )\r\n\r\nThis method store the TestComplete object which will received keys sequences\r\nrecorded in its own method ``Keys()``.\r\n\r\nIt can be set at anytime, before the call of method ``run()`` (Alias `send()`);\r\n\r\n\r\n\r\n#### Method ``keys()``\r\n\r\n\u003e Keyboard keys( String $sKeys, [ Number $nDelayMs] )\r\n\r\nThe ``Keyboard`` method `keys()` works like the TestComplete standard one and\r\naccept any sequence which respect the following documentation :\r\n[Keys Method](https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-sys-desktop-pda/keys-method-sys-desktop-object.html)\r\n\r\n\r\n````js\r\nKeyboard.keys('[HOLD]^f[Release]MySearchWord').run();\r\n// Will produce the same result as :\r\nKeyboard.ctrl('f').keys('MySearchWord').run();\r\n````\r\n\r\nYou can passe in extra parameter the delay you want to apply\r\nonly for this sequence by filling ``$nDelayMs`` where the delay \r\nis in milliseconds.\r\n\r\n\r\n\r\n#### method ``run()``\r\n\r\n\u003e Keyboard run( [ Boolean $bClearSequence = true ] )\r\n\r\nThis method call method ``Keys()`` of the provided **TestComplete**\r\nobject set by ``on()``.\r\nIf object is not defined or if it does not have method ``Keys()``,\r\nan error is logged with ``Error`` level and returns `false` .\r\n\r\nAs method ``run()`` return `Keyboard` interface, you can :\r\n\r\n- Re-execute the sequence if ``run()`` has been call with flag\r\n`$bClearSequence = false` and or append new sequences.\r\n- Record a new sequence and execute it\r\n\r\n\r\n\r\n\r\n#### method ``send()``\r\n\r\n\u003e Keyboard send( [ Boolean $bClearSequence = true ] )\r\n\r\nThis method is an alias of method ``run()``.\r\n\r\nConfer to chapter **Method ``run())``**.\r\n\r\n\r\n\r\n#### Method ``delay()``\r\n\r\n\u003e Keyboard delay( [ Number $dDelayMs = 100 ] )\r\n\r\nEach sequence recorded thanks to keyboard key methods\r\nmake a pause delay. \r\n\r\nThe default delay set \u0026 used while the sequence is recorded is ``100ms``.\r\n\r\nYou can change delay value at anytime. The new delay is used for all next\r\nrecorded sequences until you change the value again.\r\n\r\nExample : \r\n````js\r\nKeyboard.ctrl('f').keys('MySearchWord').delay(1000).enter().left().run();\r\n// Result :\r\n// Press CTLR+F and wait 100ms\r\n// Type MySearchWord and wait 100ms\r\n// Set the delay to 1000ms (from this point, all next sequences will wait for 1000ms)\r\n// Press Enter and wait 1000ms\r\n// Press left and wait 1000ms\r\n````\r\n\r\n\r\n\r\n#### Method ``wait()``\r\n\r\n\u003e Keyboard wait( [ Number $dDelayMs = 100 ] )\r\n\r\nDo not mix up with method ``delay( )``.\r\nDelay allow you to set for all sequence a delay while ``wait``\r\nperform the delay action with the provided time in ms.\r\n\r\nExample : \r\n````js\r\nKeyboard.on(Aliases.sap.TCODE_LAUNCHER)\r\n    .keys('WE19')\r\n    .wait(2000)\r\n    .run();\r\n// Result :\r\n// In SAP, in TCODE Launcher,\r\n// Type WE19\r\n// Wait 2000 ms (2s)\r\n````\r\n\r\n\r\n\r\n#### Method ``refresh()``\r\n\r\n\u003e Keyboard refresh(  )\r\n\r\nThis method allows you to force the Name Mapping refresh using\r\n``RefreshMappingInfo()``.\r\nIt's useful when element is regenerated implying the reference which no longer exist\r\neven if identifier still identical.\r\n\r\n**Important** : **Keyboard** automatically perform refresh before each action.\r\nBut it can be disabled globally and done manually with this method (``refresh``).\r\n\r\nExample : \r\n````js\r\nKeyboard.on(Aliases.browser.pageIndex.Login)\r\n    .click()\r\n    .refresh()\r\n    .click()\r\n    .run();\r\n// Result :\r\n// Click on the button 'Login'\r\n// Action will reload the page\r\n// Perform refresh on the last object set with .on() \r\n// Here : Aliases.browser.pageIndex.Login\r\n````\r\n\r\n\r\n\r\n#### Method ``autorefresh()``\r\n\r\n\u003e Keyboard refresh( Number $nDelayMs, Boolean $bEnabled )\r\n\r\nBy default, **Keyboard** automatically perform refresh before each action.\r\nBut it can be disabled globally with this method and done manually with \r\nmethod (``refresh``).\r\n\r\n**Important** : Refreshing Name Mapping has a side effect which is\r\nthe focus is reset to default position.\r\nIf you encounter focus issue, please disable automatic refresh.\r\n\r\nExample : \r\n````js\r\nKeyboard\r\n    .autorefresh(0, false)\r\n    .on(Aliases.browser.pageIndex.Login)\r\n    .click()\r\n    .refresh()\r\n    .click()\r\n    .run();\r\n// Result :\r\n// Disable autorefresh globally\r\n// Click on the button 'Login'\r\n// Action will reload the page\r\n// Perform refresh on the last object set with .on() \r\n// Here : Aliases.browser.pageIndex.Login\r\n````\r\n\r\n\r\n\r\n#### Method ``keysautoclear()``\r\n\r\n\u003e Keyboard keysautoclear( Number $nDelayMs, Boolean $bEnabled )\r\n\r\nBy default, **Keyboard** automatically perform `CTRL + A, Back Space`\r\nto clear input field before typing text requested with the method `keys()`.\r\n\r\nYou can turn off the autoclear for input fields.\r\n\r\nExample : \r\n````js\r\nKeyboard\r\n    .keysautoclear(false)\r\n    .run();\r\n// Result :\r\n// Disable auto clear globally\r\n````\r\n\r\n\r\n\r\n#### Method ``setFocus()``\r\n\r\n\u003e Keyboard setFocus(  )\r\n\r\nThis method is a SAP Specific (via Addon).\r\nIt allows use to get focus for any element in SAP Logon.\r\n\r\nExample : \r\n````js\r\nKeyboard\r\n    .on(Aliases.sap.TCODE_LAUNCHER)\r\n    .setFcous()\r\n    .run();\r\n// Result :\r\n// Place cursor (blinking) in field TCODE (in SAP)\r\n````\r\n\r\n\r\n\r\n#### Method ``function()``\r\n\r\n\u003e Keyboard function( Number $nDelayMs, Function $fFunction [, ...$args] )\r\n\r\nYou can call any function between two action registred with **Keyboard**.\r\n\r\nExample : Instead of splitting you code in two part, simply use method ``function()`` :\r\n\r\n````js\r\nlet LoadVariant_BySearch = require('LoadVariant_BySearch');\r\n\r\nKeyboard.on(Aliases.sap.TCODE_LAUNCHER)\r\n    .keys('ZME59N')\r\n    .enter()\r\n    .run();\r\n\r\nLoadVariant_BySearch('Variant');\r\n\r\nKeyboard.on(Aliases.sap.ZME59N.IN.PLANT_LOW)\r\n    .keys('S014')\r\n    .f8()\r\n    .run()\r\n````\r\n\r\nDo as following (readbility increased) :\r\n\r\n````js\r\nlet LoadVariant_BySearch = require('LoadVariant_BySearch');\r\n\r\nKeyboard.on(Aliases.sap.TCODE_LAUNCHER)\r\n    .keys('ZME59N')\r\n    .enter()\r\n    .function(0, LoadVariant_BySearch, 'Variant')\r\n    .on(Aliases.sap.ZME59N.IN.PLANT_LOW)\r\n    .keys('S014')\r\n    .f8()\r\n    .run()\r\n````\r\n\r\n\r\n\r\n#### Method ``get()``\r\n\r\n\u003e Keyboard get( String $sProperty )\r\n\r\n**Keyboard** do much more than expected for a keyboard interface, but features\r\nare a huge help in TestComplete script writing.\r\n\r\n**Keyboard** allows you to retrieve a **TestComplete** property.\r\nBy using the method ``get()``, you will take advantage of **autorefresh**\r\nand the speed of the capability to retrieve Web Element very quickly using\r\nmicro interval.\r\n\r\nPrefer \r\n\r\n````js\r\nlet sText = Keyboard.on(Aliases.sap.ME22N.HEADER.ORGA_DATA.COMPANY_CODE).get('Text');\r\n````\r\n\r\nas \r\n\r\n````js\r\nlet sText = Aliases.sap.ME22N.HEADER.ORGA_DATA.COMPANY_CODE.Text;\r\n````\r\n\r\n\r\n\r\n\r\n\r\n\r\n## List of all methods\r\n\r\nKeyboard \u003cmethod\u003e( [ String $sKey, [ Number $nDelayMs ] ] | [ Number $nDelayMs ]\r\n\r\n* ``Keyboard ctrl( [ String $sKey [,  Number $nDelayMs ] ] )`` : \r\n* ``Keyboard shift( [ String $sKey [,  Number $nDelayMs ] ] )`` : \r\n* ``Keyboard alt( [ String $sKey [,  Number $nDelayMs ] ] )`` : \r\n* ``Keyboard appsKey( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard bs( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard backspace( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard caps( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard clear( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard del( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard delete( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard down( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard end( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard enter( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard esc( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard escape( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard home( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard ins( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard insert( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard left( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard right( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard up( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard tab( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard win( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard pause( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard pageUp( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard pageDown( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard prtsc( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard print( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard printScreen( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard scrollLock( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard sl( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard slock( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numPlus( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard nump( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numMinus( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numm( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numLock( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numl( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numAsterisk( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numa( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard numSlash( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard nums( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard space( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F1( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F2( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F4( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F6( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F8( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F10( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F12( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f2( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f4( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f6( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f8( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f10( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f12( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F3( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F5( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F7( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F9( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard F11( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f1( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f3( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f5( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f7( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f9( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard f11( [ Number $nDelayMs ] )`` : \r\n* ``Keyboard keys( [ String $sKey [,  Number $nDelayMs ] ] )`` : \r\n* ``Keyboard click( )`` : \r\n* ``Keyboard clickM( )`` : \r\n* ``Keyboard clickR( )`` : \r\n* ``Keyboard dblClick( )`` : \r\n* ``Keyboard dblClickM( )`` : \r\n* ``Keyboard dblClickR( )`` : \r\n* ``Keyboard drag( )`` : \r\n* ``Keyboard dragM( )`` : \r\n* ``Keyboard dragR( )`` : \r\n* ``Keyboard hoverMouse( )`` : \r\n* ``Keyboard mouseWheel( )`` : \r\n* ``Keyboard press( )`` : \r\n* ``Keyboard setFocus( )`` : \r\n* ``Keyboard wait( Number $nDelayMs )`` : \r\n* ``Keyboard refresh( )`` : \r\n* ``Keyboard autorefresh( Number $nDelayMs, Boolean $bEnabled )`` : \r\n* ``Keyboard function( Number $nDelayMs, Function $fFunction [, ...$aA : rgs] )``\r\n* ``Keyboard on( Object $oTestCompleteAlias )`` : \r\n* ``Keyboard delay( [ Number $nDelayMs = 100 ] )`` : \r\n* ``Keyboard send( [ Boolean $bClearSequence = true ] )`` : \r\n* ``Keyboard run( [ Boolean $bClearSequence = true ] )`` : \r\n* ``Keyboard timeout( [ Number $nTimeoutMs = 30000 ] )`` : \r\n* ``Keyboard interval( [ Number $nIntervalMs = 250] )`` : \r\n* ``Keyboard get( String $sProperty [, Object $oObject] )`` : \r\n* ``Keyboard keyautoclear( [ Boolean $bEnabled = false] )`` : \r\n\r\n\r\nAll here before methods mentioned can be called from loaded ``Keyboard`` interface\r\nwith following statement :\r\n\r\n````js\r\nconst Keyboard = require('Keyboard');\r\n\r\nlet kb = Keyboard.on(Aliases.sap.MAIN).ctrl('f').enter().escape().right();\r\n````\r\n\r\n**Important** : Action will be perform on the last **TestComplete** object\r\nset with method ``on()``.\r\n\r\nAll methods have a last optional argument ``$nDelayMs`` to set the\r\ndelay time to wait at the end of the sequence. It's concerns only the \r\nsequence which is currently registering.\r\n\r\n````js\r\n// For Method accepting key :\r\nKeyboard.ctrl('f', 1000);   // Press CTRL+F \u0026 Wait 1000ms\r\n\r\n// For Method which stand for direct intput\r\nKeyboard.enter(2000);       // Press Enter \u0026 Wait 2000ms\r\n````\r\n\r\nFrom this point, you can run sequence thanks to method ``run()`` (Alias `send()`);","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneooblaster%2F-testcomplete-keyboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneooblaster%2F-testcomplete-keyboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneooblaster%2F-testcomplete-keyboard/lists"}