electron-userland / spectron

DEPRECATED: 🔎 Test Electron apps using ChromeDriver
http://electronjs.org/spectron
MIT License
1.68k stars 229 forks source link

Webdriver io isExisting method doesnt return anything if element does not exist #287

Open reetou opened 6 years ago

reetou commented 6 years ago

I'm trying to check if element exists on the page or not with isExisting() webdriverio method, but it doesnt return anything when element is not exists and works properly and returns true if it does with the following code:

@log
protected async isExisting(element: string, name?: string): Promise<boolean> {
    await this.app.client.isExisting(element)
        .then(data => {
            const isExisting = data;
            console.log(CONSOLE_COLORS.YELLOW, "IS EXISTING???", isExisting);
            return isExisting;
        })
        .catch(e => {
            console.log(CONSOLE_COLORS.RED, "no existing elem")
            return false;
        });
}

How can I write it properly? Webdriverio docs says that isExisting() method is sync and returning a promise. Sorry for creating an issue but I cannot find any answers or workarounds for this.

reetou commented 6 years ago

Nvm, was my bad. Can be closed.