Error: Argument of type 'ChainablePromiseElement' is not assignable to parameter of type 'Element'. Types of property 'parent' are incompatible. Type 'Promise<Browser | Element | MultiRemoteBrowser>' is not assignable to type 'Browser | Element' #13512
Unanswered
Dharmishta12
asked this question in
Q&A
Replies: 1 comment 5 replies
-
How about: async isDisplayed(element: WebdriverIO.Element | ChainablePromiseElement) {
const flag = await element.isDisplayed()
return flag
} I honestly would call |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have set up the webdriver version 9.
In my previous version code everything was working fine here I am getting error when I upgraded it.
This is my isDisplayed function code :
async isDisplayed(element : WebdriverIO.Element) {
const flag = await element.isDisplayed()
return flag
}
Now this is being using into my different method given below:
async isCepDisplayed(cepCode: string){
const cepCodeRow = $('.//td[contains(text(),'+cepCode+')]/..')
await browser.pause(3000)
let isRowDisplayed= await homePage.isDisplayed(cepCodeRow);
return isRowDisplayed;
}
Now here error is coming over argument passed "cepCodeRow" this error:
Argument of type 'ChainablePromiseElement' is not assignable to parameter of type 'Element'.
Types of property 'parent' are incompatible.
Type 'Promise<Browser | Element | MultiRemoteBrowser>' is not assignable to type 'Browser | Element'.
So to resolve this error I have updated my code by updating the element type from WebdriverIO.Element to ChainablePromiseElement
This is how my updated code looked like:
async isDisplayed(element : ChainablePromiesElement ) {
const flag = await element.isDisplayed()
return flag
}
By changing its type the error got resolved but when I run the script then it was not recognizing the isDisplayed() function.
and inside node modules isDisplayed function was implicitly defined as this: WebdriverIO.Element
Kindly suggest me a suitable solution.
Beta Was this translation helpful? Give feedback.
All reactions