webdriver - 如何在 webdriverio.io v7 中使用 IE 11
问题描述
经过一番研究,我尝试在 wdio.conf.js 文件中使用以下代码,以便将 IE 11 与 webdriver.io 版本 7 一起使用。它仍然无法正常工作。有什么建议么?
这就是我在 wdio.conf.js 中使用的。
第 1 行:
const drivers = {
ie: {
version: "3.150.1", // or whatever latest is
arch: "ia32", // forces use of 32 bit driver
baseURL: "https://selenium-release.storage.googleapis.com"
},
};
exports.config = {
// ...
第 65 行,带有浏览器名称,
capabilities: [{
// 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: 'ie',
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'],
}],
第 131 行:
path: '/wd/hub',
services: [
['selenium-standalone', {
logPath: 'logs',
installArgs: { drivers }, // drivers to install
args: { drivers } // drivers to use
}]
],
以上信息主要基于https://webdriver.io/docs/selenium-standalone-service。我已经从https://www.selenium.dev/downloads/下载了 IEServerDriver.exe 和 Selenium Server (Grid),并在各自的端口上启动了它们。这是我看到的错误:
ERROR webdriver: Request failed with status 500 d
ue to session not created: Unable to create session from {
[0-0] "desiredCapabilities": {
[0-0] "browserName": "ie"
[0-0] },
[0-0] "capabilities": {
[0-0] "firstMatch": [
[0-0] {
[0-0] "browserName": "ie"
[0-0] }
[0-0] ]
[0-0] }
[0-0] }
如果有人成功使用 IE 11 和 webdriver.io 版本 7,我欢迎提出建议。我也尝试过类似的服务 services: ['iexplorerdriver'],
,但无济于事。我看到它没有在此版本的https://webdriver.io/docs/gettingstarted中列出。
解决方案
我终于找到了一种方法,我认为这对你有用。
http://v4.webdriver.io/guide/services/iedriver.html
这是为 webdriver 4 编写的,但它仍然适用于 webdriver 7。我使用了以下功能:
capabilities: [{
maxInstances: 1,
browserName: 'internet explorer',
acceptInsecureCerts: false
}],
对于服务,我认为这就是所需要的:
services: ['iedriver'],
当然,你必须先通过命令行安装它:
npm install wdio-iedriver-service --save-dev
推荐阅读
- excel - 如果使用 microsoft graph api 在工作簿中存在过滤器,如何删除范围数据
- swiftui - SwiftUI 发送完整句子 WhatsApp 消息
- javascript - 猫鼬返回空数组(我尽我所能)
- sql - 使用 pg_dump 的选择性模式转储
- php - 创建一个事件订阅者来处理 Symfony 5.1 中的错误
- javascript - Onclick 事件无法生成新标题
- react-native - 如何在 CustomDrawerContent 中传递导航
- r - 在 R 中的自定义函数上使用 sapply
- excel - Excel - 通过增加文本中的数字来自动生成列
- angular - 如何在 TypeScript 中过滤另一个对象数组的对象数组?