[BUG] TimeoutError when clicking a button that displays a popup window with Webkit.
See original GitHub issueI get “locator.click: Timeout” error when I click a button that displays a popup window in Webkit.
This problem doesn’t happen with all popup windows, but it always happens where it does.
It doesn’t happen in Chromium, Chrome, Edge, Firefox.
For the time being, I am avoiding it with the following patch, but I want a fundamental solution.
type LocatorClickArgs = {
button?: "left" | "right" | "middle";
clickCount?: number;
delay?: number;
force?: boolean;
modifiers?: Array<"Alt" | "Control" | "Meta" | "Shift">;
noWaitAfter?: boolean;
position?: {
x: number;
y: number;
};
/**
* Maximum time in milliseconds.
*/
timeout?: number;
trial?: boolean;
};
interface LocatorExtendable {
clickIgnoreTimeout(options: LocatorClickArgs): Promise<void>;
}
export type LocatorEx = Locator & LocatorExtendable;
export function extendLocator(locator: Locator): LocatorEx {
const lctr = locator as LocatorEx;
const { click: _click } = lctr;
lctr.clickIgnoreTimeout = async (options) => {
try {
await _click.apply(lctr, [options]);
} catch (err: any) {
const msg = `${err.message}`;
if (
err instanceof Error &&
msg.startsWith("locator.click: Target closed")
) {
// Patch for #13090
// Ignore error.
console.warn(msg);
} else if (
err instanceof errors.TimeoutError &&
msg.startsWith("locator.click: Timeout")
) {
// Patch for this problem #18392.
// Ignore error.
console.warn(msg);
} else {
throw err;
}
}
};
return lctr;
}
The version I used is below.
Playwright: 1.27.1 Chromium: 107.0.5304.18 Chrome: 107.0.5304.63 Edge: 106.0.1370.52 Firefox: Nightly 105.0.1 Webkit: 16.0 NodeJS: 16.13.0 LTS OS: Windows 10 (21H2 / Build 19044.2006)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[BUG] Firefox Timeout while waiting for popup #3971 - GitHub
In the times where the click has failed, it's claiming to fail on clicking the element that spawns the popup even though the...
Read more >Operation timeout after switching back from popup window to ...
@SiKing I have encountered "Operation timed out after" may times when my FF browser is upgraded due to auto update enabled. In that...
Read more >Page | Playwright - CukeTest
try { // Crash might happen during a click. await page.click('button'); ... For example, when opening a popup with window.open('http://example.com') ...
Read more >Puppeteer documentation - DevDocs
An example of handling a timeout error: ... If a page opens another page, e.g. with a window.open call, the popup will belong...
Read more >Known issues with PaperCut MF, NG, Hive, Pocket and ...
Print Deploy Client may show "Can't reach this page" error on Windows. Server: 1.6.2083 ... "Test Settings" button on User/Group Sync page results...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can repro, thanks for the great repro repository! I’ll mark it as an issue for the next release.
I created test project. https://github.com/test20161010/playwright-18392 You can run with
npx playwright test
. Only webkit case will be failed. I ran this test on Windows 10.