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

feat: add mobile:webInspector to send webinspector command #1619

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
21 changes: 20 additions & 1 deletion lib/commands/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,26 @@ const extensions = {
// @ts-expect-error - do not assign arbitrary properties to `this.opts`
await this.opts.device.updateSafariSettings(preferences);
},

/**
* Send Web Inspector command to the remote debugger.
* https://github.com/appium/appium-remote-debugger/blob/717a6310dba7ccf14db8aeef28b8eac3d7f6abf9/lib/protocol/index.js
*
* @param {string} method A command method name. e.g. Page.reload
* @param {object} args Arguments for the method. Please check what arguments are available in
* https://github.com/appium/appium-remote-debugger/blob/717a6310dba7ccf14db8aeef28b8eac3d7f6abf9/lib/protocol/index.js
*/
async mobileWebInspector(method, args) {
if (this.remote) {
return;
}

await this.remote.rpcClient.send(method, {
args,
appIdKey: this.remote.appIdKey,
pageIdKey: this.remote.pageIdKey,
});
},
};

export default {...helpers, ...extensions, ...commands};
Expand All @@ -881,4 +901,3 @@ export default {...helpers, ...extensions, ...commands};
* @template {string} [S=string]
* @typedef {import('@appium/types').Element<S>} Element
*/

1 change: 1 addition & 0 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,7 @@ class XCUITestDriver extends BaseDriver {
mobileWebNav = commands.webExtensions.mobileWebNav;
mobileUpdateSafariPreferences = commands.webExtensions.mobileUpdateSafariPreferences;
clickCoords = commands.webExtensions.clickCoords;
mobileWebInspector = commands.webExtensions.mobileWebInspector;

/*--------+
| XCTEST |
Expand Down
7 changes: 7 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,11 @@ export const executeMethodMap = {
'mobile: isKeyboardShown': {
command: 'isKeyboardShown',
},
'mobile: webInspector': {
command: 'mobileWebInspector',
params: {
required: ['method'],
optional: ['args']
}
},
} as const satisfies ExecuteMethodMap<XCUITestDriver>;