Simulate Drag and Drop of Files with Playwright
If you’re trying to simulate drag and drop of files in Playwright for testing, you’llĀ need to use page.dispatchEvent to accomplish this. There is a short note on how to do this in the docs:
1 2 3 |
// Note you can only create DataTransfer in Chromium and Firefox const dataTransfer = await page.evaluateHandle(() => new DataTransfer()); await page.dispatchEvent('#source', 'dragstart', { dataTransfer }); |
But this is hardly...