Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Support transparently selecting elements under a shadow DOM #475

Closed
@ankur22

Description

@ankur22

Tested against: dbede12

When trying to create a script for an example to go on the documentation page, I found that the checkbox wasn't being found and it would eventually timeout. The script I ran using k6-browser was:

import { sleep } from 'k6';
import launcher from 'k6/x/browser';

export default function () {
  const browser = launcher.launch('chromium', {
    headless: false,
  });
  const context = browser.newContext();
  const page = context.newPage();
  page.goto("https://interactive-examples.mdn.mozilla.net/pages/tabbed/input-checkbox.html");
  const checkbox = page.locator('#horns');
  checkbox.check();

  sleep(5);
  browser.close();
}

I tested the same scenario in PW using the following and it was able to correctly select the checkbox:

// @ts-check
const { test, chromium } = require('@playwright/test');

test.describe('Editing', () => {
  test('Type login creds', async () => {
    const browser = await chromium.launch({ headless: false });
    const ctx = await browser.newContext();
    const page = await ctx.newPage();
    await page.goto("https://interactive-examples.mdn.mozilla.net/pages/tabbed/input-checkbox.html");
    const l = page.locator('#horns');
    l.check();

    await new Promise(resolve => setTimeout(resolve, 5000));

    await browser.close();
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions