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 dynamic ID

UI testing dynamic ID

UiTest Automation Playground. It's an open source project created for us to test our UI testing skills. In this section, we'll go over the same. Now you can find the link to the same in the resources. So let's go ahead and tackle the first problem, which is dynamic ID. Now you will find a pattern among all the test cases. That is first of all, you will have some information about the test, then you will have scenario or the steps which you need to take, and then the actual playground with the web elements you have to perform the test on. Now in short what this says is that in modern applications or modern websites, all elements are given dynamic IDs, classes and other attribute values. So we should not rely on them to select the elements. So if I go ahead and just inspect this button right here, which we need to click. You can see it has a ID, which is this. Now take a note of the same. When I refresh the page, the value gets changed to something different. If I go ahead and again…

Contents