Open mastrzyz opened 1 year ago
I actually faced the same issue with Teams a few weeks ago as well, and what solved the issue for me was calling Target.getTargets
with the CDP session
I actually faced the same issue with Teams a few weeks ago as well, and what solved the issue for me was calling
Target.getTargets
with the CDP session
Oddly this solves my issue.
Upstream investigation notes: RenderFrameDevToolsAgentHost::AddAllAgentHosts
skips WebContents
without a live render frame, which is the case for Electron's BrowserWindow
that was created, but never loaded the url yet. This in turn makes Target.setAutoAttach
not report a target, and Playwright never finds out about it.
Upstream Chromium fix https://chromium-review.googlesource.com/c/chromium/src/+/4546274, needs a roll to Electron.
The fix is available in Chromium 116. I've manually verified with Electron v26.0.0-alpha.3, and the issue is fixed there. We can cleanup some parts of loader.ts
once Electron 26+ is common.
I'm facing similar issues with my Electron app when bumping Playwright past v1.34.
@dgozman , do I understand correctly that the problem is on Playwright's Electron version and not on the application's Electron version?
Can Confirm: Had this exact issue, upgraded to Electron@26 resolved the problem for me.
Okay, so I have finally figured out what was making my application misbehave.
Originally, I was running my tests with "@playwright/test": "^1.29.2"
and I was importing electron
from playwright
.
import { test, expect } from '@playwright/test'
import { _electron as electron } from 'playwright'
// ...
// App correctly starts and I'm able to interact with the first window
const electronApp = await electron.launch({
executablePath: findExecutablePath(),
recordVideo: {
dir: 'test-results/videos',
},
})
After bumping to version 1.39.0
, I had to update the imports and my tests stopped working
import { test, expect, _electron as electron } from '@playwright/test'
// ...
// App correctly starts but I'm unable to interact with the first window
const electronApp = await electron.launch({
executablePath: findExecutablePath(),
recordVideo: {
dir: 'test-results/videos',
},
})
It turns out that if I remove the recordVideo
option, the tests work again and I can correctly select my first window!
import { test, expect, _electron as electron } from '@playwright/test'
// ...
// App correctly starts and I'm able to interact with the first window
const electronApp = await electron.launch({
executablePath: findExecutablePath(),
})
@dgozman, @mastrzyz could you kindly confirm if this is also the case for you? Please let me know if you'd like me to report this as a separate issue.
Edit: I've reported the issue here
Context:
System:
Binaries:
Languages:
Code Snippet Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:
Describe the bug
We let the script start the script and iterate through each window.
The App loads and we only see 3 windows and never the main window.
this goes on for a long time and will not change.
If we "Kick start" the process by opening dev tools, we see a fourth window show up. Ctrl+Shift+I
Could this be a missing
.onPage
event in Playwright not capturing the main window? Is there anyway for us to "force refresh" the current open pages in Playwright?Thanks! this wasn't reproing in Selenium for more context.