不需要像 Selenium Standalone Service 或 ChromDriver 服务这样的额外 webdriverio 服务。需要什么正确的 wdio.conf.js 或 wdio.conf.ts 。重要字段是主机名、端口、路径、协议和功能。
export const config: WebdriverIO.Config = {
//
// ====================
// Runner Configuration
// ====================
//
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
// on a remote machine).
runner: 'local',
//
// =====================
// Server Configurations
// =====================
// Host address of the running Selenium server. This information is usually obsolete as
// WebdriverIO automatically connects to localhost. Also, if you are using one of the
// supported cloud services like Sauce Labs, Browserstack, Testing Bot or LambdaTest you don't
// need to define host and port information because WebdriverIO can figure that out
// according to your user and key information. However, if you are using a private Selenium
// backend you should define the host address, port, and path here.
//
hostname: 'selenium.company.internal',
port: <number>,
path: '/wd/hub/',
protocol: 'https',
........
能力:[{
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
// grid with only 5 firefox instances available you can make sure that not more than
// 5 instances get started at a time.
'maxInstances': 5,
'browserName': 'chrome',
'acceptInsecureCerts': true,
// If outputDir is provided WebdriverIO can capture driver session logs
// it is possible to configure which logTypes to include/exclude.
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
// excludeDriverLogs: ['bugreport', 'server'],
'goog:chromeOptions': {
'args': [
// Runs Chrome in headless mode.
"--headless",
// Temporarily needed if running on Windows.
"--disable-gpu",
"--window-size=2000,1024",
// dont show the 'this browser is controlled by software' bar
"--disable-infobars"
]
}
}],