playwright-community / playwright-go

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
https://playwright-community.github.io/playwright-go/
MIT License
2.15k stars 159 forks source link

[Feature]: LaunchServer #495

Open memUsins opened 1 week ago

memUsins commented 1 week ago

Hi!

I have been using the playwright library for a while, because I may not know everything about it and its capabilities yet.

In the documentation for the Node JS library, I found the functionality I needed: LaunchServer (link to the documentation: https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server ), but in this implementation on go, I did not see anything like that.

Is there any similar functionality and, if so, how to use it? If it doesn't exist, what other workarounds are there to achieve a similar goal?

I'll explain what I need.: I am developing a microservice that should "host" browsers, giving out addresses for connection. While other microservices will go to these browsers and work with them remotely via a ws connection.

ZigHuang commented 1 week ago

Hello 👋!
I have recently been utilizing playwright-go, and upon reading your question, it occurred to me that the ExposeNetwork argument might be employed to connect to the remote browser instance? BrowserTypeConnectOptions

canstand commented 5 days ago

Run driver with params:

https://github.com/playwright-community/playwright-go/blob/6b672dbd24505206feca7c2b660da8d616c6393f/tests/remote_server_test.go#L23

https://github.com/microsoft/playwright/blob/9fcf60464d983b70b3cafea3e230e4e6e4f92c15/packages/playwright-core/src/cli/program.ts#L263

memUsins commented 5 days ago

Thanks for the suggested options. I'll try it soon and come back with the results