playwright

How to drag and drop using Playwright?


I'm trying to drag and drop images from my computer to be uploaded to a website. How can I drag and drop images from the computer to a dropzone using Playwright? I checked the Playwright docs.

Is there any way to upload files using drag and drop?

I'm told that my question is similar to another question. That's not the case. I looked at the other question and answers but it doesn't explain how to drag and drop images from computer to drop zone for uploading. Can you please re-open this question?


Solution

  • If the images are on your computer, you won't be able to do a drag and drop operation using playwright. It's only for the web portion, not desktop. Have you tried using the setInputFiles function? https://playwright.dev/docs/input#upload-files