Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
9e77d9f
chore: add workaround
KazuCocoa Nov 2, 2023
efb3ff9
chore: always return true
KazuCocoa Nov 2, 2023
206235d
chore: add caps
KazuCocoa Nov 7, 2023
e128d07
docs: tweak
KazuCocoa Nov 7, 2023
b881822
docs: add note
KazuCocoa Nov 7, 2023
21a3924
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Nov 7, 2023
9a51048
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jan 4, 2024
143cfb5
chore: do not check the installed app
KazuCocoa Jan 12, 2024
6e066fb
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jan 25, 2024
c3503af
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 14, 2024
9e469e4
Update driver.js
KazuCocoa Feb 14, 2024
20f1c5e
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 16, 2024
ee984b4
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 20, 2024
e79b5f0
remove no-deps deps
KazuCocoa Feb 23, 2024
5f8ba41
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 27, 2024
d2967b5
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 29, 2024
168c01a
Revert "remove no-deps deps"
KazuCocoa Mar 1, 2024
1df46a7
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 23, 2024
229773c
feat: add appium:usePreinstalledWDA for real iOS 17 devices (#2350)
KazuCocoa Mar 24, 2024
8cb2554
chore(release): 7.5.0 [skip ci]
semantic-release-bot Mar 24, 2024
218a0fc
chore: skip connected device check if the caps had webDriverAgentUrl …
KazuCocoa Mar 24, 2024
7836dc5
chore(release): 7.5.1 [skip ci]
semantic-release-bot Mar 24, 2024
6d516f0
chore: rename IosDeploy obhect to RealDevice to make the object meani…
KazuCocoa Mar 24, 2024
3a3b6c5
chore(release): 7.5.2 [skip ci]
semantic-release-bot Mar 24, 2024
22cef06
chore: include devicectl in IOSDeploy object (#2352)
KazuCocoa Mar 25, 2024
41f7109
docs: add description the warning is not for ios 16 and lower
KazuCocoa Mar 25, 2024
c423f37
add experimental description
KazuCocoa Mar 25, 2024
c933c8f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 25, 2024
977ba5b
fix typo
KazuCocoa Mar 25, 2024
250493e
tweak
KazuCocoa Mar 25, 2024
7c9f73c
fix lint
KazuCocoa Mar 25, 2024
c871bd2
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 25, 2024
2ad8a66
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 25, 2024
7a64ec3
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 28, 2024
80d50c6
combine if
KazuCocoa Mar 29, 2024
8358e16
update doc
KazuCocoa Mar 29, 2024
2521253
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 29, 2024
38b0e5b
move to the bottom
KazuCocoa Mar 29, 2024
188fc7e
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 3, 2024
76d9779
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 7, 2024
85d81ad
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 7, 2024
cef3c92
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 11, 2024
8a5b14f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 14, 2024
1d2381c
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 19, 2024
c88d4c4
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 26, 2024
b962bf4
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 26, 2024
db1beba
Update driver.js
KazuCocoa Apr 26, 2024
d653145
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 27, 2024
bc19c2b
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 4, 2024
fd74701
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 11, 2024
518ece0
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 21, 2024
4d8cc19
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jun 11, 2024
4ba7755
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jun 25, 2024
8c68178
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jul 3, 2024
c294317
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jul 11, 2024
5437d32
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Aug 1, 2024
4d0b52f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Aug 22, 2024
79264ff
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Sep 18, 2024
fd02bab
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Sep 24, 2024
c765bdc
fix log
KazuCocoa Oct 23, 2024
aba9e03
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Oct 23, 2024
5409206
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Nov 21, 2024
bf9e95c
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jan 11, 2025
ca7003b
update the option handling
KazuCocoa Jan 24, 2025
2feafa0
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 6, 2025
f8815a5
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 13, 2025
82de69a
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 30, 2025
8b51d89
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 29, 2025
ca73574
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Sep 16, 2025
6aa6c0f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Oct 10, 2025
f0db281
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Oct 10, 2025
4b7bbf8
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Oct 24, 2025
f77c540
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Nov 3, 2025
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
2 changes: 2 additions & 0 deletions docs/reference/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ about capabilities, refer to the [Appium documentation](https://appium.io/docs/e
|`appium:shouldTerminateApp`| Specify if the app should be terminated on session end. This capability only has an effect if an application identifier has been passed to the test session (either explicitly, by setting bundleId, or implicitly, by providing app). Default is `true` unless `noReset` capability is set to `true`. |`true` or `false`|
|`appium:forceAppLaunch`| Specify if the app should be forcefully restarted if it is already running on session startup. This capability only has an effect if an application identifier has been passed to the test session (either explicitly, by setting bundleId, or implicitly, by providing app). Default is `true` unless `noReset` capability is set to `true`. |`true` or `false`|
|`appium:useNativeCachingStrategy`| Set this capability to `false` in order to use the custom elements caching strategy. This might help to avoid stale element exception on property change. By default the native XCTest cache resolution is used (`true`) for all native locators (e.g. all, but xpath). Check the corresponding [WebDriverAgent pull request](https://github.com/appium/WebDriverAgent/pull/516) for more details. |`true` or `false`|
|`appium:skipDeviceCheck`| Whether to skip the device check in a new session request. This could help to avoid [Apple TV 4k tvOS 17](https://github.com/appium/appium/issues/19343) connection issue, but if you need this capability, the session will have communication issue with the device. Commands that can work over WebDriverAgent may work, but commands such as application installation may not work. (We do not recommend using this capability. Please use this only when you need this.) Default is `false`. | `true` or `false` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also mention this capability is temporary and we'll remove it as soon as we have a decent replacement to the ios-device lib

Copy link
Contributor

Choose a reason for hiding this comment

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

or maybe we could just use devicectl to list devices and do other stuff, so then we'd have an option to not skip, but use devicectl instead of ios-device

Copy link
Contributor

Choose a reason for hiding this comment

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

for example we could run xcrun devicectl list devices to list devices



### Simulator

Expand Down
3 changes: 3 additions & 0 deletions lib/desired-caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ const desiredCapConstraints = /** @type {const} */ ({
skipSyncUiDialogTranslation: {
isBoolean: true,
},
skipDeviceCheck: {
isBoolean: true,
},
});

export {desiredCapConstraints, PLATFORM_NAME_IOS, PLATFORM_NAME_TVOS};
Expand Down
65 changes: 44 additions & 21 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,18 @@ class XCUITestDriver extends BaseDriver {
return !(CAP_NAMES_NO_XCODEBUILD_REQUIRED.some((x) => Boolean(this.opts[x])));
}

/**
* Whether to skip the device check in a new session request.
* This is a workaround for network connected devices such as an Apple TV 4k real device.
* A situation that requires this capability may hve an issue to communicate with the device
* over appium-ios-device for example.
* Some methods that require the appium-ios-device may get issues.
* @returns {boolean}
*/
skipDeviceCheck() {
return !!this.opts.skipDeviceCheck;
}

async createSession(w3cCaps1, w3cCaps2, w3cCaps3, driverData) {
try {
let [sessionId, caps] = await super.createSession(w3cCaps1, w3cCaps2, w3cCaps3, driverData);
Expand Down Expand Up @@ -600,14 +612,16 @@ class XCUITestDriver extends BaseDriver {
await this.installAUT();

// if we only have bundle identifier and no app, fail if it is not already installed
if (
!this.opts.app &&
this.opts.bundleId &&
!this.isSafari() &&
// @ts-expect-error - do not assign arbitrary properties to `this.opts`
!(await this.opts.device.isAppInstalled(this.opts.bundleId))
) {
this.log.errorAndThrow(`App with bundle identifier '${this.opts.bundleId}' unknown`);
if (!this.skipDeviceCheck()) {
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition could be combined. Nested ifs are hard to read

Copy link
Member Author

@KazuCocoa KazuCocoa Mar 23, 2024

Choose a reason for hiding this comment

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

yea, let me modify this pr a bit later with more description about xcrun devicectl device method

!this.opts.app &&
this.opts.bundleId &&
!this.isSafari() &&
// @ts-expect-error - do not assign arbitrary properties to `this.opts`
!(await this.opts.device.isAppInstalled(this.opts.bundleId))
) {
this.log.errorAndThrow(`App with bundle identifier '${this.opts.bundleId}' unknown`);
}
}

if (this.isSimulator()) {
Expand Down Expand Up @@ -1207,19 +1221,23 @@ class XCUITestDriver extends BaseDriver {
return {device, realDevice: false, udid: device.udid};
}
} else {
// make sure it is a connected device. If not, the udid passed in is invalid
const devices = await getConnectedDevices();
this.log.debug(`Available devices: ${devices.join(', ')}`);
if (!devices.includes(this.opts.udid)) {
// check for a particular simulator
this.log.debug(`No real device with udid '${this.opts.udid}'. Looking for a simulator`);
try {
const device = await getSimulator(this.opts.udid, {
devicesSetPath: this.opts.simulatorDevicesSetPath,
});
return {device, realDevice: false, udid: this.opts.udid};
} catch (ign) {
throw new Error(`Unknown device or simulator UDID: '${this.opts.udid}'`);
if (this.skipDeviceCheck()) {
this.log.info(`Skipping connected device check. Using the given udid ${this.opts.udid}.`);
} else {
// make sure it is a connected device. If not, the udid passed in is invalid
const devices = await getConnectedDevices();
this.log.debug(`Available devices: ${devices.join(', ')}`);
if (!devices.includes(this.opts.udid)) {
// check for a particular simulator
this.log.debug(`No real device with udid '${this.opts.udid}'. Looking for a simulator`);
try {
const device = await getSimulator(this.opts.udid, {
devicesSetPath: this.opts.simulatorDevicesSetPath,
});
return {device, realDevice: false, udid: this.opts.udid};
} catch (ign) {
throw new Error(`Unknown device or simulator UDID: '${this.opts.udid}'`);
}
}
}
}
Expand Down Expand Up @@ -1656,6 +1674,11 @@ class XCUITestDriver extends BaseDriver {
return;
}

if (this.opts.bundleId && this.skipDeviceCheck()) {
this.log.info('Skipping the bundle id installation check');
return;
}

await verifyApplicationPlatform(this.opts.app, {
isSimulator: this.isSimulator(),
isTvOS: isTvOs(this.opts.platformName),
Expand Down