BrowserServer
方法
¥Methods
close
Added before v1.9正常关闭浏览器并确保进程终止。
¥Closes the browser gracefully and makes sure the process is terminated.
用法
¥Usage
await browserServer.close();
返回
¥Returns
kill
Added before v1.9终止浏览器进程并等待该进程退出。
¥Kills the browser process and waits for the process to exit.
用法
¥Usage
await browserServer.kill();
返回
¥Returns
process
Added before v1.9生成浏览器应用进程。
¥Spawned browser application process.
用法
¥Usage
browserServer.process();
返回
¥Returns
wsEndpoint
Added before v1.9浏览器 websocket url。
¥Browser websocket url.
浏览器 websocket 端点可用作 browserType.connect() 的参数来建立与浏览器的连接。
¥Browser websocket endpoint which can be used as an argument to browserType.connect() to establish connection to the browser.
请注意,如果未指定 launchServer
选项中的 listen host
选项,则无论如何都会输出 localhost,即使实际的监听地址是未指定的地址。
¥Note that if the listen host
option in launchServer
options is not specified, localhost will be output anyway, even if the actual listening address is an unspecified address.
用法
¥Usage
browserServer.wsEndpoint();
返回
¥Returns
事件
¥Events
on('close')
Added before v1.9当浏览器服务器关闭时触发。
¥Emitted when the browser server closes.
用法
¥Usage
browserServer.on('close', data => {});