jeudi 19 janvier 2017

Webdriver screenshot delay

I use selenium-webdriver with Node 7, and sometimes when I do

await driver.wait(until.elementIsVisible(buttons), timeout);
const screenshot = await driver.takeScreenshot();

The element is not present on the screenshot, so that I have to add an explicit delay:

await driver.wait(until.elementIsVisible(buttons), timeout);
await new Promise(resolve => setTimeout(resolve, 100));
const screenshot = await driver.takeScreenshot();

Does someone know the reason for this? It seems to me that the browser does not have enough time to render the element before the webdriver reports it as being visible.

Aucun commentaire:

Enregistrer un commentaire