#playwright调用本地的谷歌浏览器,指定executablepath出错,找了半天也找不到为什么,环境变量什么的都看了,看不出原因来,各位帮忙看看
代码如下:
pw, _ := playwright.Run()
//打开浏览器
fmt.Println(path)
//fmt.Println(err)
//path1 := "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
//fmt.Println(path1)
typech := "chrome"
devtoo := true
//browser, _ := pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{Headless: &head})
browser, _ := pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{ExecutablePath: &path, Headless: &head, Channel: &typech, Devtools: &devtoo})
node:events:368
throw er; // Unhandled 'error' event
^
Error: EPIPE: broken pipe, write
at Socket._write (node:internal/net:55:25)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at Socket.Writable.write (node:internal/streams/writable:334:10)
at PipeTransport.send (C:\Users\07965\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\protocol\transport.js:54:21)
at DispatcherConnection.dispatcherConnection.onmessage (C:\Users\07965\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\cli\driver.js:67:57)
at DispatcherConnection.sendMessageToClient (C:\Users\07965\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\dispatchers\dispatcher.js:187:10)
at new Dispatcher (C:\Users\07965\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\dispatchers\dispatcher.js:92:40)
at new BrowserTypeDispatcher (C:\Users\07965\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\dispatchers\browserTypeDispatcher.js:49:5)
at new PlaywrightDispatcher (C:\Users\07965\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\dispatchers\playwrightDispatcher.js:55:17)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4047,
syscall: 'write',
code: 'EPIPE'
}