diff --git a/api-reference/commands/copytextfrom.md b/api-reference/commands/copytextfrom.md index c386ae5..635bc09 100644 --- a/api-reference/commands/copytextfrom.md +++ b/api-reference/commands/copytextfrom.md @@ -4,7 +4,7 @@ You can copy text from an element and save it in-memory, to paste later. To find ### Usage Example -Copies text from an element and pastes it into a search field. +Copy text from an element and paste it into a search field: ```yaml appId: com.example.app @@ -16,3 +16,17 @@ appId: com.example.app id: "searchFieldId" - pasteText ``` + +The copied text can also be access in JavaScript using the `maestro.copiedText` +property: + +``` +appId: com.example.app +--- +- launchApp +- copyTextFrom: + id: "someId" +- tapOn: + id: "searchFieldId" +- inputText: ${'Pasted using JavaScript: ' + maestro.copiedText} +``` diff --git a/api-reference/commands/pastetext.md b/api-reference/commands/pastetext.md index a404e32..b068c8f 100644 --- a/api-reference/commands/pastetext.md +++ b/api-reference/commands/pastetext.md @@ -1,8 +1,11 @@ # pasteText -Paste any text copied with [copyTextFrom](copytextfrom.md) into the currently focused field.\ -\ -_Note: Make sure your text field is in focus before using this command._ +Paste any text copied with [copyTextFrom](copytextfrom.md) into the currently +focused field. + +{% hint style="info" %} +Make sure your text field is in focus before using this command. +{% endhint %} ```yaml - pasteText @@ -10,7 +13,7 @@ _Note: Make sure your text field is in focus before using this command._ ### Usage Example -Copies text from an element and pastes it into a search field. +Copy text from an element and paste it into a search field: ```yaml appId: com.example.app