Webdriverio v7 远程Selenium网格



如何使用内联网Selenium Grid运行webdriver-io v7测试?根据公司政策,内联网硒网格是唯一的选择吗?我可以在Webdriverio服务中找到独立硒,chrome驱动程序和一些云服务,但不适用于内部公司Selenium网格实例

在配置文件中更改此设置。 在网格中运行时

services: [],
hostname: your.domain.without.http.and.without.port,
port: 4444,
path: '/wd/hub/',
protocol: 'http',

在本地运行时

services:  ['chromedriver'],

在本地运行中,主机名、端口、路径和协议可以是任何值或删除,因为框架不会选取此值。 需要安装依赖项"wdio-chromedriver-service",因为它对于本地运行至关重要。

即使我也遇到了同样的问题。以下步骤为我提供了诀窍!

>  hostname: 'selenium.company.internal',
>     port: <number>,
>     path: '/wd/hub/',
>     protocol: 'https',

将上述值添加到 wdio.conf.js 文件中。

  • 从包中删除wdio-chromedriver-service依赖项.json 文件。
  • 做一个npm inpm ci
  • 运行您的测试 (npm run test在我的 案例)

繁荣!测试执行将在网格中启动

不需要额外的webdriverio服务,如Selenium Standalone Service或ChromDriver服务。需要什么正确的 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"
]
}
}],

最新更新