9. Using AI to Understand Actions

After finding an element, you usually perform an action.

Common actions include:

Enter text

await page.getByLabel('Username').fill('testuser');

Click

await page.getByRole('button', { name: 'Login' }).click();

Check a checkbox

await page.getByLabel('Remember me').check();

Select dropdown option

await page.getByLabel('Country').selectOption('India');

If you don’t understand any method, ask AI:

“Explain fill(), click(), check() and selectOption() in Playwright using manual testing examples.”

This makes learning easier because you are connecting automation actions with actions you already perform manually.


10. Using AI to Write Assertions

Testing isn’t only about performing actions.

We also need to verify the result.

This is where assertions come in.

For example:

await expect(page.getByText('Dashboard')).toBeVisible();

Think about manual testing.

You perform:

Click Login.

Then you check:

Dashboard should be displayed.

That verification becomes:

await expect(page.getByText('Dashboard')).toBeVisible();

You can ask AI:

“Explain Playwright assertions using manual testing examples.”

You can also ask:

“Give me 10 beginner examples of Playwright assertions.”

This will help you understand how verification works.


11. Positive Testing With AI

Let’s take a login page.

You can ask AI:

“Give me positive test scenarios for a login page.”

Possible scenarios:

You can then choose which scenarios should be automated.


12. Negative Testing With AI

Manual testers are usually very good at negative testing.

For example:

Ask AI:

“Give me negative login scenarios that a manual tester should consider before automating.”

Then ask:

“Which of these scenarios are good candidates for Playwright automation?”

This is a better use of AI than simply asking it to write 100 test cases.


13. AI Can Help You Generate Test Data

Automation often needs test data.

Suppose you want to test a registration form.

You might need:

Name
Email
Phone
Password
Country

Instead of manually creating test data, you can ask AI:

“Create 10 dummy test records for a registration form. Use fake data only.”

Example:

Name: Test User 1
Email: testuser1@example.com
Phone: 9000000001

Name: Test User 2
Email: testuser2@example.com
Phone: 9000000002

This can help you practice data-driven testing.

Important

Never provide confidential company information to an AI tool.

Do not paste:

Use dummy data while learning.


14. AI Can Help You Debug Errors

This is probably one of the most valuable uses of AI.

Imagine you execute your test and see:

TimeoutError: locator.click: Timeout exceeded

A beginner may immediately think:

“I can’t do automation.”

No.

An automation failure is often a learning opportunity.

Ask AI:

“I am learning Playwright. I received this error. Explain it in simple language and give me a checklist of things I should verify.”

AI may suggest checking:

  1. Is the locator correct?
  2. Is the button present?
  3. Is the button visible?
  4. Is another element covering it?
  5. Is the page still loading?
  6. Is the application showing a popup?
  7. Is the element inside an iframe?
  8. Is the expected page actually open?

Now you have a debugging process.


15. AI Can Explain Your Error Without Writing the Solution

This is an excellent learning technique.

Instead of saying:

“Fix my code.”

Say:

“Don’t give me the solution immediately. Explain what is causing the error and give me one hint.”

Try solving it yourself.

If you still can’t solve it, ask for another hint.

This approach helps you build problem-solving skills.


16. AI Can Help You Learn TypeScript

If you are learning Playwright with TypeScript, you don’t need to become an expert TypeScript developer immediately.

Start with the basics.

For example:

let username: string = "testuser";

If this looks confusing, ask:

“Explain this TypeScript statement to a manual tester who has never programmed.”

AI can explain:

Another example:

const browserName: string = "chromium";

Again, you can ask AI to break it down.


17. Learn async and await With AI

Many beginners get scared when they see:

async

and

await

Don’t skip them.

Ask AI:

“Explain async and await to a manual tester using a real-world example.”

Then ask:

“Explain why Playwright uses await before actions.”

Then ask:

“Give me three simple practice examples.”

You can learn the concept gradually.


18. AI Can Help You Create Practice Exercises

You don’t need to wait for a real project to practice.

Ask AI:

“Give me a beginner Playwright challenge that I can complete in 20 minutes. Don’t provide the solution.”

For example:

Challenge

Automate a search feature.

Requirements:

  1. Open website.
  2. Find search box.
  3. Enter “Laptop”.
  4. Click Search.
  5. Verify search results are displayed.

Try writing the code yourself.

If you get stuck:

“Give me one hint.”

This is much better than copying a complete solution.


19. AI Can Act Like Your Interviewer

Once you learn the basics, use AI for interview practice.

Ask:

“Act as a Playwright interviewer. Ask me one question at a time. Start with beginner-level questions.”

AI might ask:

What is Playwright?

Then:

What are locators?

Then:

What is an assertion?

Then:

What is the difference between getByRole and locator?

You answer.

AI can then review your answer.

This is especially useful for manual testers transitioning into automation roles.


20. AI Can Help You Learn Page Object Model

After learning the basics, you will eventually hear:

POM — Page Object Model

Don’t start here.

First understand basic Playwright.

Then ask AI:

“I know basic Playwright. Explain Page Object Model using a login page example.”

AI can show a structure like:

pages/
   LoginPage.ts

tests/
   login.spec.ts

Your page class might contain:

export class LoginPage {

    constructor(private page: Page) {}

    username = this.page.getByLabel('Username');

    password = this.page.getByLabel('Password');

    loginButton = this.page.getByRole('button', { name: 'Login' });
}

If this looks difficult, don’t worry.

Ask AI:

“Explain this Page Object Model code line by line for a beginner.”

Learn one part at a time.


Pages: 1 2 3 4 5 6

Leave a Reply

Your email address will not be published. Required fields are marked *