From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

UI testing AJAX request

UI testing AJAX request

For this test, we have to wait for an AHAX data to come after a delay or a trigger that is this button right here. So if I go ahead and click the button, it goes ahead and loads in the data that is sends a request for the data and take some time to get it back. And the same can be read in the steps that is press the button below, wait for data to here which should take 15 seconds and then we get the data right here so I go ahead and locate both of these that is we have a button with the text triggering a hex request so let's go ahead and first of all locate the same so our button trigger so page dot get by label or get by role locator it is a button with the name of button triggering a hacks request again I'm using the full name but you can just use a certain part as well so let's click the same now it should go ahead and load this data and it will of course take some time and this time it is not a navigation now we can go ahead and locate this paragraph right here, which has a class…

Contents