Skip to content

Instantly share code, notes, and snippets.

@zac11
Created December 18, 2022 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zac11/d68305239efb80cb0330c629b5fe191b to your computer and use it in GitHub Desktop.
Save zac11/d68305239efb80cb0330c629b5fe191b to your computer and use it in GitHub Desktop.
import { chromium,test } from "@playwright/test";
test.use({ viewport: { width: 1400, height: 1000 } });
test('Launch the Selectors hub test page',async()=>{
const browser = await chromium.launch({
headless: false
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://selectorshub.com/xpath-practice-page/");
await page.waitForSelector('.dropbtn',{
state: "visible"
});
// we want to mask this locator
let mask_locator = await page.locator("a[href='https://hubs.la/Q01nPnlN0%20']");
let mask_locator_2 = await page.locator('.dropbtn');
await page.screenshot({path: 'masked.png',mask:[mask_locator, mask_locator_2]});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment