Commit 488dd115 authored by 王舵's avatar 王舵

feat: 监听browser连接断开,重新启动 browser

parent 2a026455
...@@ -68,6 +68,7 @@ public class PlaywrightManagerImpl implements PlaywrightManager { ...@@ -68,6 +68,7 @@ public class PlaywrightManagerImpl implements PlaywrightManager {
this.browser.onDisconnected((browser) -> { this.browser.onDisconnected((browser) -> {
log.info("浏览器实例已断开连接"); log.info("浏览器实例已断开连接");
this.browser.close(); this.browser.close();
userContexts.clear();
this.browser = playwright.chromium().launch(new BrowserType.LaunchOptions() this.browser = playwright.chromium().launch(new BrowserType.LaunchOptions()
.setHeadless(true) .setHeadless(true)
.setArgs(java.util.Arrays.asList( .setArgs(java.util.Arrays.asList(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment