Skip to content

Commit

Permalink
docs: Add code examples for extension methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Oct 27, 2023
1 parent 1e4dc25 commit 25a7cb6
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,49 @@ snapshotMaxDepth | int | The number of maximum depth for the source tree snapsho

## Platform-Specific Extensions

Beside of standard W3C APIs the driver provides the following custom command extensions to execute platform specific scenarios:
Beside of standard W3C APIs the driver provides the below custom command extensions to execute platform specific scenarios. Use the following source code examples in order to invoke them from your client code:

```java
// Java 11+
var result = driver.executeScript("mobile: <methodName>", Map.of(
"arg1", "value1",
"arg2", "value2"
// you may add more pairs if needed or skip providing the map completely
// if all arguments are defined as optional
));
```

```js
// WebdriverIO
const result = await driver.executeScript('mobile: <methodName>', [{
arg1: "value1",
arg2: "value2",
}]);
```

```python
# Python
result = driver.execute_script('mobile: <methodName>', {
'arg1': 'value1',
'arg2': 'value2',
})
```

```ruby
# Ruby
result = @driver.execute_script 'mobile: <methodName>', {
arg1: 'value1',
arg2: 'value2',
}
```

```csharp
// Dotnet
object result = driver.ExecuteScript("mobile: <methodName>", new Dictionary<string, object>() {
{"arg1", "value1"},
{"arg2", "value2"}
});
```

### mobile: shell

Expand Down

0 comments on commit 25a7cb6

Please sign in to comment.