Playwright Recorder webextension for Chrome / Edge and Firefox #30347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was able to set up a basic PoC for playwright recorder as a webextension, and currently runs in Chrome, Edge and Firefox.
Instead of trying to run the whole playwright stack as a webextension, it only runs the necessary bits from
recorder.ts
, which already has lots of isomorphic code. For instance, alll code generation logic is almost isomorphic right now, except the usage of EventEmitter, which is the only polyfill I had to import.In terms of webextensions APIs, I'm only using chrome APIs that are compatible with firefox, namely:
For the purpose of this PoC, I implemented lighter versions of server
page
,frame
andbrowserContext
with only the necessary bits, and copied the serverrecorder.ts
to remove all the things that don't make sense for the webextension.TLDR: most of the code needed for the recorder to work is already isomorphic or only needs some minor adjustments. Non-isomorphic code can be replaced with implementations that rely on webextension APIs.
Firefox Demo:
fT80LktCcB.mp4
Chrome Demo:
i4TKZ2VYZG.mp4