@@ -177,6 +177,14 @@ export function toAIFriendlyError(error: unknown, selector: string): Error {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle general timeout (element exists but action couldn't complete)
|
||||||
|
if (message.includes('Timeout') && message.includes('exceeded')) {
|
||||||
|
return new Error(
|
||||||
|
`Action on "${selector}" timed out. The element may be blocked, still loading, or not interactable. ` +
|
||||||
|
`Run 'snapshot' to check the current page state.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle element not found (timeout waiting for element)
|
// Handle element not found (timeout waiting for element)
|
||||||
if (
|
if (
|
||||||
message.includes('waiting for') &&
|
message.includes('waiting for') &&
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ describe('BrowserManager', () => {
|
|||||||
{ url: () => 'http://anothersite.com', on: vi.fn() },
|
{ url: () => 'http://anothersite.com', on: vi.fn() },
|
||||||
],
|
],
|
||||||
on: vi.fn(),
|
on: vi.fn(),
|
||||||
|
setDefaultTimeout: vi.fn(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
close: vi.fn(),
|
close: vi.fn(),
|
||||||
|
|||||||
@@ -1029,6 +1029,7 @@ export class BrowserManager {
|
|||||||
this.cdpEndpoint = cdpEndpoint;
|
this.cdpEndpoint = cdpEndpoint;
|
||||||
|
|
||||||
for (const context of contexts) {
|
for (const context of contexts) {
|
||||||
|
context.setDefaultTimeout(10000);
|
||||||
this.contexts.push(context);
|
this.contexts.push(context);
|
||||||
this.setupContextTracking(context);
|
this.setupContextTracking(context);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user