Playwright Tutorial

Handling Alerts in Playwright Handling Alerts in Playwright import {Page,expect,test,Locator,Browser,chromium,firefox,webkit} from ‘@playwright/test’; //Handling Alert test(‘Handle Alert’, async ({ page }) => {     page.on(‘dialog’, async dialog => {     console.log(dialog.type());     Read more »
Handling files in Playwright Handling files in Playwright import {test, Page, Locator, expect,FileChooser } from ‘@playwright/test’; //uploading single file test(‘Upload single file’,async({page})=> {  await page.goto(“https://www.file.io/”);   let uploadIcon:Locator=await page.locator(“//label[@for=’select-files-input’]”);  await uploadIcon.setInputFiles(‘C:/Users/AnandaBabuGummadilli/Documents/Anand_Details/VEDL_Info.docx’);  await page.waitForTimeout(5000); }); Read more »
Handling Webtable in Playwright Handling Webtable in Playwright import {test,expect,Locator, Browser, Page} from ‘@playwright/test’; import {chromium,webkit,firefox} from ‘playwright’; test(‘handling web table’,async()=>{     const browser:Browser=await chromium.launch({headless:false, channel:’chrome’});     const rsPage:Page=await browser.newPage();     Read more »
Read Excel data in Playwright Read Excel data in Playwright import {expect, Page, Browser, test} from ‘@playwright/test’; import { readFile, utils, read as _read } from ‘xlsx’; const xlsx = require(‘xlsx’); //const path=”C:\\Users\\Anand.Gummadilli\\Documents\\Anand_Details\\PlaywrightDemo\\PlaywrightDemo-1\\tests2\\Anvesh.xlsx”; const path=”C:\\Users\\anand\\OneDrive\\Documents\\PlaywrightDemo\\PlaywrightDemo\\tests2\\Anvesh.xlsx”; Read more »
Exception Handling in Playwright Exception Handling in Playwright import { test, expect,Page, Browser, Locator } from ‘@playwright/test’; import { webkit, chromium, firefox } from ‘playwright’; test.describe(‘Exception handling in Playwright’, () => {     Read more »
Session Storage in Playwright Session Storare in Playwright In Playwright, Session Storage is maintained per page (tab) within a browser context. Unlike Local Storage, there is no direct API like context.storageState() for Session Storage. Read more »
Authentication Strategies in Playwright Authentication Strategies in Playwright Authentication is one of the most important Playwright interview topics. Companies almost never ask you to automate the login page in every test—they expect you to Read more »
Reading JSON,Excel,CSV in Playwright Reading JSON, Excel, and CSV files is a very common requirement in Playwright for data-driven testing. Here’s a complete guide with examples using Playwright + TypeScript. Reading JSON in Playwright Read more »
Retry Mechanism in Playwright Retry Mechanism in Playwright Retries in Playwright help reduce flaky test failures caused by temporary issues such as network delays, slow page loads, or timing problems. If a test fails, Read more »
Environment Variables in Playwright Environment Variables in Playwright Why use Environment Variables? ✅ Avoid hardcoding sensitive information ✅ Run tests against different environments (Dev, QA, UAT, Prod) ✅ Improve security ✅ Easier CI/CD integration Read more »