Node.js 如何在webdriver.io中以32位模式启动IE
我正在使用npm包运行测试 在 我在gulp中运行的代码是:Node.js 如何在webdriver.io中以32位模式启动IE,node.js,selenium,webdriver-io,cucumberjs,Node.js,Selenium,Webdriver Io,Cucumberjs,我正在使用npm包运行测试 在 我在gulp中运行的代码是: gulp.task('e2e', function () { return gulp.src('wdio.conf.js') .pipe(wdio({ wdio: { specs: './test/features/**/*.feature' } })); }); 我的wdio.conf.js是这样定义浏览器的: capabilities: [
gulp.task('e2e', function () {
return gulp.src('wdio.conf.js')
.pipe(wdio({
wdio: {
specs: './test/features/**/*.feature'
}
}));
});
我的wdio.conf.js是这样定义浏览器的:
capabilities: [
{
browserName: 'internet explorer',
version: 'ANY'
}
],
,我在互联网上发现,运行32位版本的web驱动程序可以解决这个问题,但无论如何,我都找不到如何配置功能或其他默认情况下运行IE32位驱动程序的地方。。。
任何帮助都将不胜感激@:-)经过两天的研究,我找到了解决方案 需要向selenium单机版提供一个配置文件 如图所示
因此,我们的最终设置是这样完成的:
capabilities: [
{
browserName: 'internet explorer',
version: 'ANY'
}
],
我们有一个名为wdio.browsers.setup.js的配置文件,其中包含浏览器设置:
module.exports = {
baseURL: 'https://selenium-release.storage.googleapis.com',
version: '3.3.1',
drivers: {
chrome: {
version: '2.29',
arch: process.arch,
// - Recent versions of the driver: https://sites.google.com/a/chromium.org/chromedriver/
baseURL: 'https://chromedriver.storage.googleapis.com'
},
ie: {
version: '3.0.0',
arch: 'ia32',
// - Recent versions of the driver: http://selenium-release.storage.googleapis.com/index.html
baseURL: 'https://selenium-release.storage.googleapis.com'
},
firefox: {
version: '0.15.0',
arch: process.arch,
baseURL: 'https://github.com/mozilla/geckodriver/releases/download'
}
}
};
然后在wdio.conf.js中加载它并分配给一个特殊的参数
let browsersSetup = require('./wdio.browsers.setup');
exports.config = {
seleniumArgs: browsersSetup,
seleniumInstallArgs: browsersSetup,
在那之后一切都很好@:-)
注意:如果已全局安装web驱动程序,请先删除全局安装程序,它位于:
C:\Users\%USERNAME%\AppData\Roaming\npm
然后,您可以使用以下方式运行本地安装:
./node_modules/.bin/selenium-standalone install --config=../../wdio.browsers.setup.js
请查找以下IE浏览器安装32位的工作解决方案:
services: ["selenium-standalone"],
seleniumArgs: {
drivers: {`enter code here`
ie: {
version: "3.4.0", // or whatever latest is
arch: "ia32", // forces use of 32 bit driver
baseURL: "https://selenium-release.storage.googleapis.com"
},
},
},
seleniumInstallArgs: {
drivers: {
ie: {
version: "3.4.0", // or whatever latest is
arch: "ia32", // forces use of 32 bit driver
baseURL: "https://selenium-release.storage.googleapis.com"
},
},
},
那么投票吧:-)好东西@OBender!我被困在这个问题上好几个小时了。