Skip to content

[Feature]: Allow us to set the full path to cli js (driver) #575

@Crocmagnon

Description

@Crocmagnon

Does the upstream have similar features?
I don't know

Is your feature request related to a problem? Please describe.
This is a followup to #496.
I'm trying to use playwright-go on NixOS with official packages instead of a 3rd party dependency as the original issue.
The official playwright-driver has no package subdirectory, so getDriverCliJsfails to resolvecli.js`.
https://github.com/playwright-community/playwright-go/blob/56e30d60f8b42785982469eaca6ad969bc2e1946/run.go#L337C6-L339

Describe the solution you'd like
Actually allow us to specify the full path to the directory containing cli.js without making assumptions on the directory structure.

Additional context
Example flake to reproduce the issue (use with nix develop):

{
  description = "Playwright development environment";
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
  inputs.nixpkgs-pw.url = "github:NixOS/nixpkgs/979daf34c8cacebcd917d540070b52a3c2b9b16e";

  outputs = { self, flake-utils, nixpkgs, nixpkgs-pw }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        overlay = final: prev: {
          inherit (nixpkgs-pw.legacyPackages.${system}) playwright-driver;
        };
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ overlay ];
        };
      in
      {
        devShells = {
          default = pkgs.mkShell {
            packages = [
              pkgs.nodejs
              # pkgs.playwright-test
            ];
            shellHook = ''
              export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
              export PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"
              export PLAYWRIGHT_DRIVER_PATH="${pkgs.playwright-driver}"
              export PLAYWRIGHT_NODEJS_PATH="${pkgs.nodejs}/bin/node"
            '';
          };
        };
      });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions