New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Dismiss right click contextual menu easily #30736
Comments
Alerts are auto-dismissed by default, you can also handle them manually, see https://playwright.dev/docs/dialogs Does the context menu shown on right click affect further execution of your test? If so, can you share the code where it happens? In the example from the description the escape key is dispatched to the page but not to the native popup. That shouldn't affect the web page's behavior though. |
Apologies. It's not an alert. It's a toast like this Unfortunately, I can't share the exact code to reproduce. However, on some non M series Macs, a lot of times, the script stops executing two or three pages after the right click is triggered. I want to close the contextual menu once it is triggered. I am not able to reproduce the issue with an extended version of the above test. Is there a way I can get some debug info without sharing the exact code? |
With this page the following example works just fine: import { test, expect } from '@playwright/test';
test('test', async ({ page }) => {
await page.goto('https://ui.shadcn.com/docs/components/toast');
await page.getByRole('button', { name: 'Add to calendar' }).click();
await expect(page.getByText('Scheduled: Catch up', { exact: true })).toBeVisible();
await page.keyboard.press('Escape');
await expect(page.getByText('Scheduled: Catch up', { exact: true })).not.toBeVisible();
});
We need a reproducible example to act on this. It may well be a hydration problem where 'Escape' key handler is added after you pressed it in playwright. |
We need more information to act on this report. Please file a new one and link to this issue when you get back to it! |
馃殌 Feature Request
Currently there seems to be now way of dismissing the right click contextual menu once it is clicked.
Example
Motivation
My application shows an alert when it detects a right click but after that I am unable to dismiss the right click for the rest of the test.
The text was updated successfully, but these errors were encountered: