Skip to content
Draft
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
19 changes: 19 additions & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { Client } from 'webdriver';
import {
getPlatformName,
isAndroidUiautomator2DriverSession,
isXCUITestDriverSession,
PLATFORM,
getCurrentContext as getStorecCurrentContext,
} from './session-store.js';
import type { DriverInstance } from './session-store.js';
import type { StringRecord, Element as AppiumElement } from '@appium/types';
import { util } from '@appium/support';
import type {
IOSRecordingOptions,
AndroidRecordingOptions,
Expand Down Expand Up @@ -138,6 +142,21 @@ export async function elementClick(
driver: DriverInstance,
elementUUID: string
): Promise<void> {
// iOS platform, AND for WebView context
// TODO: this should consider nativeWebTap capability and not just platform + context
if (
getPlatformName(driver.sessionId) === PLATFORM.ios &&
getStorecCurrentContext(driver.sessionId as string | undefined)?.startsWith(
'WEBVIEW_'
)
) {
return await execute(
driver,
'arguments[0].click();',
util.wrapElement(elementUUID)
);
}

if (isAndroidUiautomator2DriverSession(driver)) {
return await driver.click(elementUUID);
} else if (isXCUITestDriverSession(driver)) {
Expand Down
Loading