【发布时间】:2015-01-29 10:24:31
【问题描述】:
我有一个在 java 中使用 Selenium Webdriver 的测试自动化项目。我想使用 Grunt 任务(我是 Grunt 新手)开始驱动测试。我使用 grunt-selenium-webdriver 插件(Git 这里:https://github.com/levexis/grunt-selenium-webdriver)
我安装了这个插件,并在 Gruntfile.js 中添加了这部分 webdriver
grunt.initConfig({
webdriver: {
options: {
desiredCapabilities: {
browserName: 'chrome'
}
},
login: {
tests: ['Test/Automation/NextGenWebViewerUI/src/test/java/com/autodesk/infraworks/webviewer/tests/*.java'],
},
},
});
grunt.loadNpmTasks('grunt-selenium-webdriver');
然后,我用这个命令运行这个任务
grunt webdriver
但我收到了警告:
>> Grunt script called with:
>> Tasks: webdriver
>> Options:
Warning: Task "webdriver" not found. Use --force to continue.
任何人都可以帮助我或有使用示例吗?非常感激!
【问题讨论】:
-
您缺少一些配置。看看这个例子 - gruntjs.com/sample-gruntfile.
-
@AleksandrM:谢谢,我拿了这个例子,所有的 javaScript 插件,我使用 Java,所以它似乎不能这样工作。我更新了我的问题。有什么想法吗?
-
Java?那你为什么要使用 grunt 呢?根据
grunt-selenium-webdriver的文档,其中有 3 个任务(selenium_start、selenium_stop 和 selenium_phantom_hub)。
标签: java node.js selenium-webdriver automation gruntjs