How To Wait For API Response | Playwright Tutorial - Part 44

preview_player
Показать описание
Hello guys, in this video, we'll learn how to wait for the API response body and check the status of the API.

Reference:

Source code:
--------------------------Thank you---------------------------

Thanks for watching, if you like the video, give it a thumbs up 👆.
Sharing is caring, kindly share the video with your friends and colleagues.
Don't forget to subscribe and hit the bell 🔔 notification.
--------------------------------SOCIAL--------------------------------

Join our WhatsApp group.

#letcode #playwright
Рекомендации по теме
Комментарии
Автор

Thanks for creating these tutorials, Koushik
🙂
Really appreciate your efforts.

rajatt
Автор

thanks for video buddy, finally was able to get response body

Dudarinho
Автор

Dear Koushik, thank you for your amazing work. In this video, I got wondering about the order in which the different Promises are defined within the array that is provided to the "Promise.all" method . In your video, I noticed that the "request submission click command" is defined as the last element of the "Promise.all" array. As I understand it, if the "Promise.all" is sequentially evaluated, this click-up command should be the first to be defined in the array.

Please, let me know your thoughts in this regard.

Sincerely,

philipeleal
Автор

I'm a bit confused why you used Promise.all here and not just wrote `await` in front of every instruction. Because you want to await the response _and then_ start filling out the input, right? And in theory, the button-click could finish before the input is filled.

dasten
Автор

Thanks a lot Koushik. This helped me to resolve my issue. 👍

prasadverma
Автор

Hi Koushik,
for navigating to a url, how to make sure
that the method used was X (get or post i.e.) and response code was 200.

ahmadsohail
Автор

Hi koushik,
How can we run get request with a payload/body? I did not find any info about it.
Thanks

moshedror
Автор

thanks for the video, and how to get the same data if the response is not a json, the response looks like this, in response or preview section, alert('Failed to save file.');

davidvardanyan
Автор

This is great tutorial. But what if the network request (GET) is loaded when page is loaded (no other action is taken on the page) and need wait for that get request and verify specific response body.

Actually I was able to figure that out by adding page.goto within the promise.all.

binitpatel
Автор

Hey Koushik,

You helped me a lot with your tutorials so far. I am stuck on a small problem

My console log doesn't return anything it's empty.

I am using other api not the one in the example. I closely followed anything you did. Any tips on why is that happening.

Aowek
Автор

Perfect. Is there a way to get multiple response api (2 different res.url()) instead of just one for

itsperksen
Автор

What if you have multiple api requests that are getting triggered as soon as we click on button, how to capture all the responses. Could you please let me know.

srikanthjk
Автор

Hi g, I'm having doubt can I send oauth url and get the token in playwright apicontext, is it possible, if possible pls share it to me it's really helpful

ajvencilous
Автор

Hi Koushik, quick question: as far as I know, promises inside Promise.all are being executed asynchronous. Because of this async, what guarantee can one have that page.fill() finishes filling "ortonikc" in the input field, before page.click() is triggered? If for some reason input field gets bit flacky (and button does not), isn't there a risk that click() might get executed before fill() finishes?

silvius
Автор

Hi Koushik, What is the best approach for wait Until page is completed loaded??
Some Times navigating to Letcode.in is failed because it is taking more time to load

saivamshikrishnapeddammala
Автор

Hello! I have been following your videos so far get many info about playwright. I am still new and many things to learn. Is there any documentation can I use to understand API endpoint testing?TIA

TurkeyThailand
Автор

Thanks for video sir!

I am facing weird issue with async. Without executing after each, global tear down called in JEST. How to debug these kind of cases? Like by using --detectopenhandles? Any reference plz

suramsridharreddy
Автор

Hi Koushik, is it possible to wait for dom events? Eg: I am dispatching custom events like messageSent, and I want to add document.addEventListener to listen for this event, to check if it was fired.
Is there anything for this?

adi_sekar
Автор

Mate keep it going . Make more tutorials on Request, Response, Route

subhra_s_das
Автор

Hi Koushik, thanks for the playwright tutorial it is helping me a lot.

Could you please help me on below query?

How to verify list of URL's i.e. broken links validation (lets assume need to verify 200 URL's whether its working or not i.e. giving status code 200 or not) and I have acheived this through Cypress but need help on Playwright with JavaScript.

It would be a great help!!

ramutalari