使用黄瓜时“ when”不是函数nodejs错误

时间:2019-06-14 17:41:25

标签: node.js cucumber cucumberjs

var webdriver = require('selenium-webdriver');

var browser = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();

const {Then, When} = require('cucumber');
const assert = require('assert');

 When(/^I search Google for "([^"]*)"$/, (text) =>{

      browser.get('http://www.google.com');
}) ;

When(/^I enter "([^"]*)" in input$/, function(expression){

       browser.get('http://www.google.com');
}) ;

1 个答案:

答案 0 :(得分:0)

您需要将“何时”和“然后”合并为一个无效的const。要解决此问题,您可以使用“ {cum,then}}从“ cucumber”中导入;