From 590a82e01192cf1bc15aa646a43591a3b4980608 Mon Sep 17 00:00:00 2001 From: Elliot Sabitov Date: Thu, 15 Oct 2026 19:25:02 -0400 Subject: [PATCH] fix(webdriver): click iOS elements with the W3C elementClick command click, checkOption and uncheckOption called the JSON Wire touchClick command on non-Android mobile sessions. webdriverio 9 deprecates it and webdriverio 10 removes it. elementClick is the W3C command the helper already uses on Android and desktop, and Appium XCUITest supports it. --- lib/helper/WebDriver.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index b2395255c..08a623821 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -1079,7 +1079,6 @@ class WebDriver extends Helper { * */ async click(locator, context = null) { - const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick' const locateFn = prepareLocateFn.call(this, context) const res = await findClickable.call(this, locator, locateFn) @@ -1090,7 +1089,7 @@ class WebDriver extends Helper { } const elem = selectElement(res, locator, this) highlightActiveElement.call(this, elem) - return this.browser[clickMethod](getElementId(elem)) + return this.browser.elementClick(getElementId(elem)) } /** @@ -1390,7 +1389,6 @@ class WebDriver extends Helper { * {{> checkOption }} */ async checkOption(field, context = null) { - const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick' const locateFn = prepareLocateFn.call(this, context) const res = await findCheckable.call(this, field, locateFn) @@ -1403,7 +1401,7 @@ class WebDriver extends Helper { const isSelected = await isElementChecked(this.browser, elementId) if (isSelected) return Promise.resolve(true) - return this.browser[clickMethod](elementId) + return this.browser.elementClick(elementId) } /** @@ -1411,7 +1409,6 @@ class WebDriver extends Helper { * {{> uncheckOption }} */ async uncheckOption(field, context = null) { - const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick' const locateFn = prepareLocateFn.call(this, context) const res = await findCheckable.call(this, field, locateFn) @@ -1424,7 +1421,7 @@ class WebDriver extends Helper { const isSelected = await isElementChecked(this.browser, elementId) if (!isSelected) return Promise.resolve(true) - return this.browser[clickMethod](elementId) + return this.browser.elementClick(elementId) } /**