我有这样的脚本:
this.When(/^I should be logged in$/, function(value){
console.log('> ', this.driver.executeScript('return "test"'));
});
console.log的输出是
> { then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
而不是
"> test"
答案 0 :(得分:0)
尝试:
this.When(/^I should be logged in$/, function(value){
var result = this.driver.executeScript('return "test"');
console.log('> ', result );
});
答案 1 :(得分:0)
这是解决方案
var result = this.driver.executeScript('return "test"');
result.then(function(value){
console.log(value)
})
因为我认为它使用异步来与驱动程序通信。