Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This package contains the Chrome Extensions flavor of the Playwright library.

...

  1. Existing chrome recorder

Using existing recorder we can generate playwright steps using playwright locator generator.

below are some files which are responsible for selector generation


Implemented in files like:

  • packages\playwright-core\src\server\injected\consoleApi.ts

  • packages\playwright-core\src\server\injected\recorder\recorder.ts

  • packages\playwright-core\src\server\injected\selectorGenerator.ts

  • packages\playwright-core\src\server\injected\injectedScript.ts

It's not an easy job. A deep dive is necessary to fully understand their locator generation engine

Here's a concise breakdown of the pros and cons for implementing a Playwright script recorder as a Chrome extension versus a desktop app:

Chrome Extension:

Pros:

  1. Easy distribution through Chrome Web Store

  2. Seamless integration with Chrome browser

  3. Cross-platform compatibility (works on any OS that runs Chrome)

  4. Automatic updates

Cons:

  1. Limited access to system resources

  2. Restricted to Chrome browser only

  3. Potential performance limitations

  4. Subject to Chrome's extension policies and restrictions

Desktop App:

Pros:

  1. Full access to system resources

  2. Can work with multiple browsers

  3. More flexibility in design and functionality

  4. Potentially better performance

Cons:

  1. More complex distribution and installation process

  2. Requires separate builds for different operating systems

  3. Manual update process for users

  4. May require additional security measures

Conclusion

While we can't use the full Playwright library directly in Chrome extensions due to its Node.js dependency, we've found a solution in Playwright CRX. This flavor of Playwright is specifically designed for Chrome extensions, allowing us to leverage much of Playwright's functionality in a browser-compatible format.

We're planning to use specific JavaScript files from Playwright CRX that generate locators and action code snippets. This approach gives us access to Playwright's powerful selector generation capabilities and automation features, tailored for use within Chrome extensions.

By adopting Playwright CRX, we can implement efficient automation in our extension while benefiting from Playwright's robust selection strategies and browser interaction capabilities. This method provides a balance between the power of Playwright and the specific requirements of Chrome extension development.