Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] inconsistency with OOPIF #5815

Closed
gilles-yvetot opened this issue Mar 13, 2021 · 9 comments
Closed

[BUG] inconsistency with OOPIF #5815

gilles-yvetot opened this issue Mar 13, 2021 · 9 comments

Comments

@gilles-yvetot
Copy link

Context:

  • Playwright Version: 1.9.2
  • Operating System: Mac
  • Node.js version: 14.15.1
  • Browser: Chromium
  • Extra: Persistent context to load an extension

Code Snippet

I have created a small repo here:

  • git clone
  • npm i
  • node pw.js

But the 2 main parts are those

Playwright launch script

const { chromium } = require('playwright')
const path = require('path')
;(async () => {
  const EXTENSION_PATH = path.resolve('./ext')
  const context = await chromium.launchPersistentContext(`userDataDir`, {
    defaultViewport: null,
    headless: false,
    timeout: 0,
    devtools: true,
    ignoreDefaultArgs: [
      `--no-sandbox`,
      `--disable-default-apps`,
      `--disable-dev-shm-usage`,
      `--disable-sync`,
      `--disable-hang-monitor`,
      `--disable-extensions`,
      `--enable-automation`,
      `--password-store=basic`,
      `--use-mock-keychain`,
      `--disable-popup-blocking`,
      `--disable-prompt-on-repost`,
      `--force-color-profile=srgb`,
      `--disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies`,
      `--disable-background-timer-throttling`,
      `--disable-backgrounding-occluded-windows`,
      `--disable-ipc-flooding-protection`,
      `--disable-renderer-backgrounding`,
      `--disable-background-networking`,
      `--disable-client-side-phishing-detection`,
      `--disable-component-extensions-with-background-pages`,
      `--metrics-recording-only`,
      `--no-first-run`,
    ],
    args: [
      `--profile-directory=Default`, // always launch default
      `--load-extension=${EXTENSION_PATH}`,
      `--allow-insecure-localhost`, // to make sure that we can communicate to local wss
    ],
  })

  const page = await context.newPage()
  await page.goto('https://google.com/', { waitUntil: `networkidle` })
  const frames = await page.mainFrame().childFrames()
  console.log('frames.length', frames.length) // frame is visible
})()

Extension content script

chrome.extension.sendMessage({}, function (response) {
  var readyStateCheckInterval = setInterval(function () {
    if (document.readyState === 'complete') {
      clearInterval(readyStateCheckInterval)
      debugger
      const iframe = document.createElement(`iframe`)
      iframe.src = 'https://playwright.dev/'
      iframe.id = 'myFrame'
      Object.assign(iframe.style, {
        position: `absolute`,
        top: 0,
        left: 0,
        width: 500,
        height: 500,
      })
      document.documentElement.appendChild(iframe)
    }
  }, 10)
})

Describe the bug

I have multiple issues with OOPIF but they are inconsistent. There is one I could repro everytime though. I cannot select an element with the devtools selector inside the injected iframe. PW detects it but it looks the devtools don't detect it.

@avodovnik
Copy link
Contributor

@JoelEinbinder can you have a look at this?

@JoelEinbinder
Copy link
Contributor

To clarify, the issue here is that DevTools can't see the injected frame? Or is there something broken with playwright itself.

@gilles-yvetot
Copy link
Author

@JoelEinbinder I don't know if they are related but yes Devtools could not see the iframe when connected with PW but could see them fine without PW.
There were other inconsistencies but they are not 100% reproducible. We actually had the same with pptr a year ago, and switching to PW fix them

@JoelEinbinder
Copy link
Contributor

@dgozman do you have any thoughts here? I think we pass it on to the DevTools team. Sounds like a frontend problem.

@gilles-yvetot
Copy link
Author

@JoelEinbinder my guess was there is a new flag added by PW because it worked without PW. But you know more than me!

@dgozman
Copy link
Contributor

dgozman commented Mar 16, 2021

@dgozman do you have any thoughts here? I think we pass it on to the DevTools team. Sounds like a frontend problem.

Yeah, I've seen similar issues myself. I am not surprised, given how much special OOPIF code we have. I guess having Playwright attached may affect some timings to make the issue more prominent, but it still sounds like a frontend issue.

@gilles-yvetot
Copy link
Author

gilles-yvetot commented Mar 16, 2021

@dgozman I know that's not supported, but I have many problems with Chrome during extension testing. Most likely they are async/timing issues like you mention because they don't always occur

@dgozman
Copy link
Contributor

dgozman commented Mar 16, 2021

@dgozman I know that's not supported, but I have many problems with Chrome during extension testing. Most likely they are async/timing issues like you mention because they don't always occur

Please file them as separate issues, we'll do our best to fix them! This one is related to Chrome DevTools that we do not control, so it is harder to get traction. Other issues that might be Playwright-specific we'll be easier to fix.

@pavelfeldman
Copy link
Member

Closing as per above, in anticipation for fine-grained issues. Thanks for reporting them, sorry I have to close this to keep our bug database actionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants