我有這樣的方法:將WebDriver承諾轉換爲本地承諾?
isOnPage(): Promise<boolean> {
return this.subtitle.isPresent();
}
的打字稿編譯器會發出此錯誤:
Type 'webdriver.promise.Promise<boolean>' is not assignable to type 'Promise<boolean>'
有沒有辦法給webdriver的承諾轉化爲本地的承諾?
會這樣嗎?
isOnPage(): Promise<boolean> {
return new Promise(() => {
return this.subtitle.isPresent();
});
}
'webdriver.promise.Promise'是不同類型比本地'Promise'。 – AntonB
爲什麼你需要轉換爲本地承諾? – Gunderson
當項目中有多個承諾實現時,團隊會感到困惑。 –