Replies: 1 comment 1 reply
-
We are in the process of improving the async API which should make your use case possible. See more here: https://github.com/webdriverio/webdriverio/blob/cb-async-api-blog-post/website/blog/2021-07-25-sync-api-deprecation.md. A release is expected within the next days. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello dear Wdio team :)
We still trying to migrate page objects from protractor to webdriverio and bumped into next problem - we can't use custom command chaining on Promise< Element >
in Page Object:
private parentElement = $('element')
get product(): CustomWebWrapper {
return new CustomWebWrapper( this.parentElement.dataId('childElement'))
}
in conf file:
browser.addCommand('dataId', function(selector: string) {
return this.$$(
[data-id=${selector}]
);}, true);
The problem is to use dataId command in chain if previous element not awaited. I mean this way it will work :
async product(): Promise {
return new CustomWebWrapper((await this.parentElement).dataId('anyChildLocator'));
}
but then we need to rework all usages of getters to functions and also rewrite getters to async functions. Is there any workaround to use custom commands on Promise ?
Beta Was this translation helpful? Give feedback.
All reactions