Selenium WebDriver wait till element is displayed

后端 未结 9 806
死守一世寂寞
死守一世寂寞 2020-11-29 04:14

I have searched on Google and the SO site and I get answers for JAVA but do not seem to get answers for node.js

I have a web app that takes time to load. I would like

9条回答
  •  长情又很酷
    2020-11-29 04:23

    I came up with this approach because it maintains the chainable promise syntax so that I can write this: await waitFind(By.id('abc')).click()

    const waitFind = (locator) => {
        return driver.findElement(async () => {
            await driver.wait(until.elementLocated(locator));
            return driver.findElement(locator);
        });
    }
    

提交回复
热议问题