Skip to content

Commit c59138d

Browse files
committed
added support for XCuiTest
1 parent 08f79ff commit c59138d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/plugin.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default class WaitCommandPlugin extends BasePlugin {
1515
async _find(driver, locatorArgs) {
1616
const strategy = locatorArgs[0];
1717
const selector = locatorArgs[1];
18-
const automationName = this._getAutomationName(driver);
18+
const baseUrl = this._constructSessionUrl(driver);
1919
const response = await fetch(
20-
`http://${driver[automationName].host}:${driver[automationName].systemPort}/wd/hub/session/${driver.sessionId}/element`,
20+
`${baseUrl}wd/hub/session/${driver.sessionId}/element`,
2121
{
2222
body: JSON.stringify({
2323
strategy,
@@ -42,6 +42,15 @@ export default class WaitCommandPlugin extends BasePlugin {
4242
}
4343

4444
_getAutomationName(driver) {
45-
return driver.caps.automationName.toLowerCase();
45+
return driver.caps.automationName;
46+
}
47+
48+
_constructSessionUrl(driver) {
49+
const automationName = this._getAutomationName(driver);
50+
if (automationName === 'XCuiTest') {
51+
return `${driver.wda.wdaBaseUrl}:${driver.wda.wdaLocalPort}/`;
52+
} else {
53+
return `http://${driver[automationName].host}:${driver[automationName].systemPort}/`;
54+
}
4655
}
4756
}

0 commit comments

Comments
 (0)