Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Support custom devtools server commands #21

Merged
merged 7 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions lib/command_definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,7 @@ export let rotationGesture = new CommandDefinition(
});
export let shakeDevice =
new CommandDefinition<void>('shakeDevice', [], 'POST', 'appium/device/shake');
export let sendCommand =
new CommandDefinition<void>('sendCommand', ['cmd', 'params'], 'POST', '/chromium/send_command');
export let sendCommandAndGetResult = new CommandDefinition<Object>(
'sendCommandAndGetResult', ['cmd', 'params'], 'POST', '/chromium/send_command_and_get_result');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious — since I am unfamiliar with these chromium commands — is there a practical difference between them besides not returning a result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I'm just exposing the two commands available in the devtools client. Not all devtools commands will necessarily return a result.

4 changes: 4 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ export interface ExtendedWebDriver extends WebDriver {

// See https://github.com/webdriverio/webdriverio/blob/v4.6.1/lib/protocol/shake
shakeDevice: () => wdpromise.Promise<void>;

sendCommand: (cmd: string, params: Object) => wdpromise.Promise<void>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a consistent pattern for naming, but what about something like sendChromiumCommand to make the connection to the chromium tools clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


sendCommandAndGetResult: (cmd: string, params: Object) => wdpromise.Promise<Object>;
}

export function extend(baseDriver: WebDriver, fallbackGracefully = false): ExtendedWebDriver {
Expand Down