0

I am facing issue in using "sendKeys in protractor.sendkeys will send intial data(Questions are taken from json file)at faster speed and as data increase in loop(later questions like 563rd,440th questions) the speed decreases increasing suite execution time.

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 file:

{
 "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
]
}

I tried using npm package "node-key-sender". i added require of this package at the start of spec file var ks = require('node-key-sender');

and altered the loop as follows:

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());
    }

is this the right way of using sendText?? If not how can i use it?? or is there any solution other than using sendkeys.

Supritha
  • 51
  • 3
  • 1
    `node-key-sender` is used to simulate keyboard actions directly to the active application that is running(similar to robot class in Java). It is nothing to do with protractor. I'm curious to know why you have used `expect(converse.inputBox()).toBe(true); ` and `expect(converse.enterImageclick());` ? I guess this is the culprit! – Sudharsan Selvaraj Oct 06 '17 at 06:53
  • You can optimize / speed up sending data to Protractor. [This answer here explains the options you have](https://stackoverflow.com/a/25740114/8683679) – Ernst Zwingli Oct 07 '17 at 19:14

0 Answers0