Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copyTextFrom: add docs for JS use #74

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 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.
Copy text from an element and paste it into a search field:

```yaml
appId: com.example.app
Expand All @@ -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}
```
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