Replies: 2 comments
-
_, b := os.LookupEnv("PLAYWRIGHT_BROWSERS_PATH")
if !b {
err = os.Setenv("PLAYWRIGHT_BROWSERS_PATH", dir+"/tools/browser/")
if err != nil {
log.Errorln("set env PLAYWRIGHT_BROWSERS_PATH fail" + err.Error())
err = nil
}
}
pwo := &playwright.RunOptions{
DriverDirectory: dir + "/tools/driver/",
SkipInstallBrowsers: true,
Browsers: []string{"msedge"},
}
pwt, err := playwright.Run(pwo)
if err != nil {
log.Errorln("[core]", "init the playwright fail")
log.Errorln("[core] ", err.Error())
return
}
if path == "" {
path = "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"
}
browser, err := pwt.Chromium.Launch(playwright.BrowserTypeLaunchOptions{
ExecutablePath: playwright.String(path),
}) You can customize the location of the browser by setting ExecutablePath, and set SkipInstallBrowsers to determine whether to skip downloading the browser. If you need to download the browser, you can use the environment variable PLAYWRIGHT_BROWSERS_PATH to set the location of the browser download,my roommate's playwright-go version is v0.2000.1. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Refer https://playwright.dev/docs/browsers#google-chrome--microsoft-edge and #340 browser, err := pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{
Channel: playwright.String("chrome"),
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I did see a push referencing the "local chrome path" pull request but I cannot tell the difference when I run the code it still's installs the playwright-md files.
I want to be able to use my installation of chrome as a driver not what the package wants to install.
Beta Was this translation helpful? Give feedback.
All reactions