Skip to content

Instantly share code, notes, and snippets.

@zac11
Created November 20, 2022 06:41
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/48069800f9f8d9ee5756b25dd9bbbe0b to your computer and use it in GitHub Desktop.
Save zac11/48069800f9f8d9ee5756b25dd9bbbe0b to your computer and use it in GitHub Desktop.
Nested shadow DOM
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"
});
await page.locator('#userName input#pizza').fill('Mozarella'); // element is inside nested shadow DOM
await page.waitForTimeout(5000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment