PlaywrightPractice

1. getByRole() Locators

Locate elements by their explicit or implicit ARIA roles.

Buttons

Div with button role

Form Elements

Navigation

2. getByText() Locators

Locate elements by their text content.

This paragraph contains some important text that you might want to locate.

Another paragraph with colored text for demonstration.

  • List item 1
  • List item 2 with link
  • Special: Unique text identifier

Click the button above to submit your information.

3. getByLabel() Locators

Locate form controls by their associated label text.

Shipping Method

4. getByPlaceholder() Locators

Locate input elements by their placeholder text.

5. getByAltText() Locators

Locate elements (usually images) by their alt text.

logo image

Playwright Logo

6. getByTitle() Locators

Locate elements by their title attribute.

Hover over these elements to see their titles:

  • Home
  • HTML
  • This text has a tooltip

7. getByTestId() Locators

Locate elements by their data-testid attribute (or other configured attribute).

John Doe

john.doe@example.com

Product A

$19.99

Product B

$29.99

Product C

$39.99

This page demonstrates various Playwright locators for testing purposes.

Upload Files

Static Web Table

BookName Author Subject Price
Learn Selenium Amit Selenium 300
Learn Java Mukesh Java 500
Learn JS Animesh Javascript 300
Master In Selenium Mukesh Selenium 3000
Master In Java Amod JAVA 2000
Master In JS Amit Javascript 1000

Dynamic Web Table

Pagination Web Table

ID Name Price Select