How To Upload Files Using Playwright | Playwright - Part 6

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

ความคิดเห็น • 85

  • @arunpahilajani918
    @arunpahilajani918 2 ปีที่แล้ว

    Your video helped me - I was stuck in the dispatchevent method for a while to accomplish the same task

    • @letcode
      @letcode  2 ปีที่แล้ว

      Glad to know 👍

  • @NikhilThakare-z1y
    @NikhilThakare-z1y ปีที่แล้ว +1

    Hi , find all session very informative and interesting. will you plz add a video regarding cucumber/gherkin integration with playwright?

    • @letcode
      @letcode  ปีที่แล้ว

      Hi, th-cam.com/video/bfWXNLqKlvA/w-d-xo.html

  • @sridevilanka6940
    @sridevilanka6940 3 ปีที่แล้ว +1

    Hi Koushik, can you please create a tutorial on downloading a file with playwright. Thanks for creating playwright playlist for everyone, your tutorials are concise right to the point. Will eagerly look forward to have this tutorial on your playwright playlist.

    • @letcode
      @letcode  3 ปีที่แล้ว +1

      Yes sure, thank you 😊

  • @johnsanchez5056
    @johnsanchez5056 3 ปีที่แล้ว +1

    Good job! thanks for this helpful tutorial. I just want to ask if you have an idea on how to this(uploading multiple files) using sendkeys.

  • @nelsonivantontarelli3957
    @nelsonivantontarelli3957 2 ปีที่แล้ว +1

    Thanks you very much! I code in Python, anyway I'd undestand and you help me to resolve my code

  • @guillermopodesta9499
    @guillermopodesta9499 2 ปีที่แล้ว +1

    Hi Koushik, quick question, I would like to upload a file in an API test, It is just a POST where I need to upload a file in order to get an uid of it as a response. How can I do it?

    • @letcode
      @letcode  ปีที่แล้ว

      Hi, same as we used to do in postman.

  • @lakshbhutani6793
    @lakshbhutani6793 2 ปีที่แล้ว +1

    Hi Koushik, thanks for making videos...Just wanted to know when should we trigger the below lines in case of file upload tests:
    await page.close();
    await context.close();
    await browser.close();
    Because if we do it at the end of the test...the test finishes before the file is uploaded due to which the test fails..Please tell the place where these lines of code should be used?
    Thanks

    • @letcode
      @letcode  2 ปีที่แล้ว

      Playwright mostly waits for uploads to complete but if not working then you can add a page.waitForTimeout(10 or 25 sec)
      Then you can close the browser.

  • @moriyamegidish6345
    @moriyamegidish6345 2 ปีที่แล้ว +1

    Thanks for all your videos and guidance they are beneficial :)
    Is there a way how to compare 2 files? I am downloading a file using the playwright waitForEvent after that I am storing the file in some path and I am looking for a solution on how to compare this file to a different "base" file or a different file that I am going to download from another location in my project

    • @letcode
      @letcode  2 ปีที่แล้ว

      You can use javascript library to compare files.

  • @dragon3602010
    @dragon3602010 3 ปีที่แล้ว +2

    Bonjour,
    awesome bro , I love it ;)
    Thanks

    • @letcode
      @letcode  3 ปีที่แล้ว +1

      😁

  • @johncyvarghese9136
    @johncyvarghese9136 ปีที่แล้ว +1

    Is it possible to add these file path into tsconfig.json rather than keeping it on the test file?

    • @letcode
      @letcode  ปีที่แล้ว

      Yes, i have explained that in some video.

  • @j.k.ravshanovich
    @j.k.ravshanovich ปีที่แล้ว +1

    👏👏👏

  • @VishalDeshpande1985
    @VishalDeshpande1985 3 ปีที่แล้ว +1

    Hi Sir
    It's very informative and thank you very much for guidance. can you please throw some light on playwright with folio And page object model or automation framework using it.

    • @letcode
      @letcode  3 ปีที่แล้ว +1

      HI, Thanks for the feedback, as I am suffering from COVID 19, I am not able to make any tutorial. Once I recovered I will continue the playwright tutorial with advance topic.

    • @VishalDeshpande1985
      @VishalDeshpande1985 3 ปีที่แล้ว

      @@letcode Get well soon sir

  • @raviteja-qk3br
    @raviteja-qk3br 2 หลายเดือนก่อน +1

    Thank you

    • @letcode
      @letcode  2 หลายเดือนก่อน

      Happy learning 🎈

  • @shahiakriti
    @shahiakriti 2 ปีที่แล้ว +2

    Hi Koushik, I tried working refering to your code in this video but getting Error: ENOENT: no such file or directory, open './tests/uploads/download.jpeg'.. Any idea as to what maybe the issue here?
    Thanks!

    • @letcode
      @letcode  2 ปีที่แล้ว

      Seems like path error to me.

    • @shahiakriti
      @shahiakriti 2 ปีที่แล้ว +1

      @@letcode Thanks for the response. The path is correct yet I am getting this error :(

    • @letcode
      @letcode  2 ปีที่แล้ว

      Is it jpeg or jpg.
      Instead of test folder move the file to root and try to access it as i did.
      So we'll understand the real issue.

    • @shahiakriti
      @shahiakriti 2 ปีที่แล้ว +1

      @@letcode It is .jpeg. So I moved the file to the root folder as you said. Still getting the same error!

    • @letcode
      @letcode  2 ปีที่แล้ว +1

      @@shahiakriti can u share screenshot in our discord?

  • @visonabletest2966
    @visonabletest2966 2 ปีที่แล้ว +1

    U used prefix 'x' for the some of the tests. which means?

    • @letcode
      @letcode  2 ปีที่แล้ว

      XTEST means it will skip that particular test execution.

  • @nitityagi6101
    @nitityagi6101 ปีที่แล้ว +1

    Hi Koushik, while uploading the file i am getting this error "Error: ENOENT: no such file or directory, stat 'filePath', however The files I need to upload are in that folder( lives in this directory)the playwright folder is where the rest of the project lives as well Im running the tests by typing npx playwright test

    • @letcode
      @letcode  ปีที่แล้ว

      Right click on the file to upload and click copy relative path, change the slash to forward slash and try.

  • @rameshpadi2168
    @rameshpadi2168 2 ปีที่แล้ว +1

    Hi Koushik,
    if method return type is bool,
    How to store in variable?/
    I have used like
    let status:boolean;
    status=page.Getstatus();
    I getting error 'Type 'boolean' is not assignable to type 'false'
    Please help me on this

    • @letcode
      @letcode  2 ปีที่แล้ว

      Your syntax is correct only, is that return Boolean or promise of Boolean

  • @steveulysse7259
    @steveulysse7259 2 ปีที่แล้ว +1

    How do I perform this with a file not on my local machine? Let say I have a file on a network drive, how do I upload that file using playwright?

    • @letcode
      @letcode  2 ปีที่แล้ว +1

      Not sure about it, you can ask in the playwright GitHub.

  • @RyanRedpath-t5u
    @RyanRedpath-t5u 11 หลายเดือนก่อน

    Hi, This is great, and works fine locally on my laptop. However if I try and run on the CI tool we are using - GH Actions, the file does not upload? Any ideas?

    • @letcode
      @letcode  10 หลายเดือนก่อน

      is the file also available on git?

    • @RyanRedpath-t5u
      @RyanRedpath-t5u 10 หลายเดือนก่อน +1

      @@letcode I managed to work this out, was my bad on dir path. Works great thank you!

    • @letcode
      @letcode  10 หลายเดือนก่อน

      @user-ml9gp3ll4o awesome.

  • @bhavindesai8003
    @bhavindesai8003 2 ปีที่แล้ว +1

    I tried replicating the same code but am getting "fileChooser.setFiles: Target closed". How can we resolve this error?

    • @letcode
      @letcode  2 ปีที่แล้ว

      Seems like the popup window is closed.

    • @bhavindesai8003
      @bhavindesai8003 2 ปีที่แล้ว +1

      @@letcode Sorry brother.. but didn't get the solution. Which popup window you are talking about.. Is it about the chromium browser one? if yes then can you help me to resolve that by providing the steps..
      Thanks in advance.

    • @letcode
      @letcode  2 ปีที่แล้ว

      Yeah might the chromium or the upload window,
      If u can share the code in discord i can probably help.

  • @aakashsingh3711
    @aakashsingh3711 2 ปีที่แล้ว +1

    Do you have a complete course on udemy?? or somewhere else .. if yes , please share the link

    • @letcode
      @letcode  2 ปีที่แล้ว +1

      The complete course is in the TH-cam playlist only ☺️.
      Not in udemy 😀

  • @pankajsingh2200
    @pankajsingh2200 ปีที่แล้ว +1

    can we upload folder using filechooser?

    • @letcode
      @letcode  ปีที่แล้ว

      No.
      We can upload multiple files.

  • @yuvaraj1334
    @yuvaraj1334 3 ปีที่แล้ว +1

    Could u pls explain file upload using page object model in playwright

    • @letcode
      @letcode  3 ปีที่แล้ว

      Same code only, r u facing any issues?

    • @yuvaraj1334
      @yuvaraj1334 3 ปีที่แล้ว +1

      @@letcode yea.. the error seems in file location..

    • @letcode
      @letcode  3 ปีที่แล้ว

      @@yuvaraj1334 ok got it, I'll make a video on this

    • @yuvaraj1334
      @yuvaraj1334 3 ปีที่แล้ว +1

      @@letcode thanks a lot... And one more help... Can u tell the code for closing the multi select option field.. I tried selectoption.. but it was not working.

  • @gopichandan6814
    @gopichandan6814 2 ปีที่แล้ว +1

    Hello Sir i am getting describe error...!!!!

    • @letcode
      @letcode  2 ปีที่แล้ว

      I hope you haven't installed the dependencies

    • @gopichandan6814
      @gopichandan6814 2 ปีที่แล้ว +1

      @@letcode can you please tell me how to face this error

    • @letcode
      @letcode  2 ปีที่แล้ว

      Check the installation video bro,
      th-cam.com/video/AdFgipIPAlg/w-d-xo.html

  • @No-yp1uv
    @No-yp1uv 3 ปีที่แล้ว +1

    Can you put the herokuapp link?

    • @letcode
      @letcode  3 ปีที่แล้ว

      the-internet.herokuapp.com/upload

    • @No-yp1uv
      @No-yp1uv 3 ปีที่แล้ว +1

      For this link when we run the playwright test should we click inside the box for the listener to respond?

    • @letcode
      @letcode  3 ปีที่แล้ว

      Yes.

  • @AirbnbGlasgow-lv1ru
    @AirbnbGlasgow-lv1ru 2 ปีที่แล้ว +1

    please send python code someone which works

    • @letcode
      @letcode  2 ปีที่แล้ว

      Is it solved?

  • @johnsanchez5056
    @johnsanchez5056 3 ปีที่แล้ว +1

    Hello. I tried it in typescript protractor. but it does not work. Here is my code:
    let filepath = "C:/Users/LAPTOP-174/Desktop/nospinner.JPG";
    let filepath2 = "C:/Users/LAPTOP-174/Desktop/speedtest.JPG";
    let fpath = path.resolve(__dirname,filepath);
    let fpath2 = path.resolve(__dirname,filepath2);
    await $('input[type="file"]').sendKeys(fpath);

    • @letcode
      @letcode  3 ปีที่แล้ว

      I haven't checked yet, In selenium we can pass the 2 file path in send keys.
      You can try the same.
      Eg. Sendkeys (path1, path1)

    • @johnsanchez5056
      @johnsanchez5056 3 ปีที่แล้ว

      @@letcode Hello. I tried it earlier, but it does not execute. It works only for one file.

    • @letcode
      @letcode  3 ปีที่แล้ว

      Trying in playwright or selenium ?

    • @johnsanchez5056
      @johnsanchez5056 3 ปีที่แล้ว

      Our framework is protractor typescript.