Skip to content

Commit

Permalink
copyTextFrom: add docs for JS use
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 24, 2024
1 parent 7f281b8 commit f43b1d8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
15 changes: 14 additions & 1 deletion api-reference/commands/copytextfrom.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copies text from an element and pastes it into a search field:

```yaml
appId: com.example.app
Expand All @@ -16,3 +16,16 @@ 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}
```
11 changes: 7 additions & 4 deletions api-reference/commands/pastetext.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# 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
```
### 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
Expand Down

0 comments on commit f43b1d8

Please sign in to comment.