[Feature] Support executing playwright code (--eval)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 128
- Avg merge
- 9d 15h
- Merged PRs (30d)
- 2
Description
javascript is a useful function but lacks many of the niceties provided by playwright. It would be nice to be able to make use of playwright by providing an eval-unsafe (or playwright?) subcommand that evaluates playwright code in the scope of the "page" variable.
This feature would also make it much easier to run simple one-off playwright scripts without all of the package/project management and page setup boilerplate code. e.g. shot-scraper --eval-unsafe 'page.querySelector('a').getAttribute('href').
Obviously 'eval' is in general a security risk but shouldn't be a problem in the context of non-server facing code (which is a minority use case in shot-scraper?). It should be explicitly labeled as unsafe: e.g. --eval-unsafe
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing javascript CLI function and command parsing, then trace how the page variable is created. The requested behavior is an explicitly unsafe eval subcommand that evaluates code in the page scope; done means a one-off Playwright-style expression can run without project boilerplate and the unsafe nature is clearly labeled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100