如何在量角器中使用sendtext / send节点密钥发送器pacakge的组合将密钥发送到输入框

时间:2017-10-05 14:46:53

标签: node.js protractor send sendkeys

我在使用protractor.sendkeys中的“ sendKeys 时会遇到问题,会以更快的速度发送初始数据(问题来自json文件)并且循环中的数据增加(后来的问题如563rd,440th问题)速度降低了套件执行时间。

for( var k = 0; k < 1000 ;k++)     
{   
var questions = data.Questions[k];  
expect(converse.inputBox()).toBe(true); 
element(by.id('Inputbox')).sendKeys(questions);
expect(converse.enterImageclick());
}

Json文件:

{
 "Questions":
[
"Can I talk to everyone involved in an email?",
"Reply to all",
"Reply all",
"Can I respond to everyone copied in an email?",
"How do I say something back to everyone?",
"How do I reply to all?",
"Can I respond to everyone in a conversation?",
"Can I change how contacts are stored?",
"How do I sort contacts?",
"Sort contacts",
"Can I see my contacts by first name?",
"Can I pick how contacts are displayed?",
 ................................continues to 1000+questions
]
}

我尝试使用npm包“node-key-sender”。 我在spec文件的开头添加了这个包的要求 var ks = require('node-key-sender');

并按如下方式更改循环:

for( var k = 0; k < 1000 ;k++)     
    {   
    var questions = data.Questions[k];  
    expect(converse.inputBox()).toBe(true); 
    element(by.id('Inputbox').sendText(questions);
    expect(converse.enterImageclick());
    }

这是使用sendText的正确方法吗?如果不是我怎么能用它?或者除了使用sendkeys之外还有其他解决方案。

0 个答案:

没有答案