Playwright Test
Playwright Test provides a test function to declare tests and expect function to write assertions. import { test, expect } from '@playwright/test'; test('basic test', async ({ page }) => { await page.goto('https://playwright.dev/'); const name Read more »
Playwright Library: Launch Browser
Playwright Library: Launch Browser: Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright to drive automation: import {test, Locator, Expect, Read more »
Page Object Model (POM) in Playwright
Page Object Model (POM) in Playwright Google.Spec.ts //spec file which have test case import {test, Locator, Expect, chromium, Browser, Page, expect} from ‘@playwright/test’; import { googlePage } from ‘./Pages/googlePage’; //Import Read more »
Assertions in Playwright
Assertions in Playwright: Playwright includes test assertions in the form of expect function. To make an assertion, call expect(value) and choose a matcher that reflects the expectation. There are many generic matchers like toEqual, toContain, toBeTruthy that can be used Read more »
Locators in Playwright
Locators in Playwright import { test, expect,Page, Browser, Locator, chromium } from ‘@playwright/test’; //Find Element By Xpath test(‘Findelement By xpath’,async({})=>{ const browser:Browser=await chromium.launch({headless:false, channel:’chrome’}); const Read more »
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 »
