microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.99k stars 3.68k forks source link

[Feature] Support OR locators within iframes #24140

Closed kblok closed 1 year ago

kblok commented 1 year ago

If I run this script:

const playwright = require("playwright");

(async () => {
  const browser = await playwright.chromium.launch({
    headless: false,
  });
  let page = await browser.newPage();

  await page.goto(
    "https://www.w3schools.com/JSREF/tryit.asp?filename=tryjsref_onclick",
    { waitUntil: "load" }
  );

  const frameLocator = page.frameLocator("#iframeResult");

  const locator = frameLocator
    .locator("input")
    .or(frameLocator.locator("button"))
    .or(frameLocator.locator("div"));
  await locator.first().waitFor({ timeout: 30000 });

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

I get a Frames are not allowed inside "internal:or" selectors error. It would be nice to have that at least documented here.

Nav-2d commented 1 year ago

https://github.com/microsoft/playwright/issues/23697

Coming in 1.36 or you can use next version for now