跳至主要內容

獨立模式

您也可以在沒有 WDIO 測試執行器的情況下使用服務,例如在一般的 Node.js 腳本中。

startElectron 方法接受ElectronServiceOptions,使用您的配置創建新的 WDIO 會話,並返回 WebdriverIO 瀏覽器物件。

import { startElectron } from 'wdio-electron-service';

const browser = await startElectron({
appBinaryPath: '/path/to/binary',
appArgs: ['foo', 'bar=baz'],
});

const appName = await browser.electron.execute((electron) => electron.app.getName());

歡迎!我能幫您什麼嗎?

WebdriverIO AI Copilot