Skip to content

Commit 8963356

Browse files
bessonefreekmurze
authored andcommitted
Implement timeout error handling for locator clicks
Added error handling for locator click timeouts.
1 parent 9b929cc commit 8963356

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

bin/browser.cjs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,17 @@ const callChrome = async pup => {
340340
if (request.options && request.options.locatorClicks) {
341341
for (let i = 0, len = request.options.locatorClicks.length; i < len; i++) {
342342
let clickOptions = request.options.locatorClicks[i];
343-
await page.locator(clickOptions.selector).click({
344-
'button': clickOptions.button,
345-
'clickCount': clickOptions.clickCount,
346-
'delay': clickOptions.delay,
347-
});
343+
try {
344+
await page.locator(clickOptions.selector).click({
345+
'button': clickOptions.button,
346+
'clickCount': clickOptions.clickCount,
347+
'delay': clickOptions.delay,
348+
});
349+
} catch (error) {
350+
console.error('Timeout error:', error);
351+
}
348352
}
349-
}
353+
}
350354

351355
if (request.options && request.options.addStyleTag) {
352356
await page.addStyleTag(JSON.parse(request.options.addStyleTag));

0 commit comments

Comments
 (0)