-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Drag and drop zip file #13364
Comments
Let's consider translating Buffer into the ArrayBuffer as a value-type. |
Resolved with next code
|
From example of @LiutskoOlga, I've make a generic function: import { Page } from '@playwright/test';
import { readFileSync } from 'fs';
const dragAndDropFile = async (
page: Page,
selector: string,
filePath: string,
fileName: string,
fileType = ''
) => {
const buffer = readFileSync(filePath).toString('base64');
const dataTransfer = await page.evaluateHandle(
async ({ bufferData, localFileName, localFileType }) => {
const dt = new DataTransfer();
const blobData = await fetch(bufferData).then((res) => res.blob());
const file = new File([blobData], localFileName, { type: localFileType });
dt.items.add(file);
return dt;
},
{
bufferData: `data:application/octet-stream;base64,${buffer}`,
localFileName: fileName,
localFileType: fileType,
}
);
await page.dispatchEvent(selector, 'drop', { dataTransfer });
}; It will be nice to offer this directly in Playwright. Currently there is |
I released a utility |
Why was this issue closed?Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors. If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated. |
What is "data" here? Should it have been announced before?
|
The second argument to |
Hello, could you help me please with drug and drop zip file?
The text was updated successfully, but these errors were encountered: