Coder Social home page Coder Social logo

Comments (9)

pavelfeldman avatar pavelfeldman commented on August 26, 2024

I had to modify the script because

  • original page is broken and never stops loading
  • i am in the US and have no cookie dialog
test("1.45 debug", async ({ page }) => {
  await page.goto("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_link_target", { waitUntil: "domcontentloaded" });
  // await page.getByText("Accept all & visit the site").click();

  const page1Promise = page.context().waitForEvent("page");
  await page.frameLocator('iframe[name="iframeResult"]').getByRole("link", { name: "Visit W3Schools.com!" }).click();
  const page1 = await page1Promise;
// URL is printed
  console.log(page1.url());
// Expect stuck
  await expect(page1).toHaveURL(/w3schools/, { timeout: 2_000 });
// locator() doesn't work
  await expect(page1.getByText("Learn to Code")).toBeVisible({ timeout: 2_000 });
});

And it works for me on all browsers:

Running 3 tests using 3 workers
[chromium] › example.spec.ts:20:6 › 1.45 debug
https://www.w3schools.com/
[firefox] › example.spec.ts:20:6 › 1.45 debug
https://www.w3schools.com/
[webkit] › example.spec.ts:20:6 › 1.45 debug
https://www.w3schools.com/
  3 passed (8.3s)

from playwright.

truthanb avatar truthanb commented on August 26, 2024

On my windows pc this all worked, as it did for @pavelfeldman . On macos and in the docker container I was able to replicate @unickq 's issue.

from playwright.

pavelfeldman avatar pavelfeldman commented on August 26, 2024

I'm on macOS 14.5 for reference.

from playwright.

superhit0 avatar superhit0 commented on August 26, 2024

I am facing a similar problem where in case of popups I am not getting title of the popup

const popupPromise = page.waitForEvent('popup');
  await page.setContent(`<a href="https://www.google.com" target="_blank">Go to Google</a>`);
  const locator = await page.locator('a');
  await locator.click();
  const popup = await popupPromise;
  await popup.waitForLoadState();

  // Works Fine
  expect(await popup.evaluate(() => document.title)).toMatch('Google');
  // Indefinitely Stuck
  expect(await popup.title()).toMatch('Google');

The problem is that I am not able to reproduce it in a standalone project but I am able to consistently face this problem in my company repo where we extend the test. I will comment again if I am able to reproduce it in a standalone project.

For now I am sending it here to see if we can get any inputs.

Edit1:
Removing --disable-web-security from launch args seem to solve the problem but trying to figure out why

Edit2:
I do not know why removing --disable-web-security fixes my problem but I am going ahead with that as we were not passing --disable-site-isolation-trials or --user-data-dir so that flag was a no-op for chromium anyways

from playwright.

unickq avatar unickq commented on August 26, 2024

That's interesting; I can't reproduce it anymore. Because of 127.0.6533.5 -> 127.0.6533.17?

But it's there with --disable-web-security, added to the first comment

from playwright.

pavelfeldman avatar pavelfeldman commented on August 26, 2024

I can repro, disabling web security skips some of the JS context-related signals so Playwright misbehaves. Why are you disabling the web security?

from playwright.

superhit0 avatar superhit0 commented on August 26, 2024

For me, it came when we migrated from puppeteer to playwright and we did disable web security in chromium to disable csp and cors.

from playwright.

pavelfeldman avatar pavelfeldman commented on August 26, 2024

For me, it came when we migrated from puppeteer to playwright and we did disable web security in chromium to disable csp and cors.

Are you a testing solution or a scraping solution? If you are a testing solution, you are not really testing what your users will get.

from playwright.

superhit0 avatar superhit0 commented on August 26, 2024

For me, it came when we migrated from puppeteer to playwright and we did disable web security in chromium to disable csp and cors.

Are you a testing solution or a scraping solution? If you are a testing solution, you are not really testing what your users will get.

Testing solution. Yeah --disable-web-security there would be security gaps that would be missed but then having something rather than nothing was preferred.

Now since the situation is better now. Thanks to playwright 🙌 , we have removed --disable-web-security so it should be better

from playwright.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.