I am trying to give some keypresses from Jenkins and possibly type something unto the notepad. the program works fine when I ran it from cmd manually. but it does not work when I run it using Jenkins. Why is this happening? is it even possible to give key presses from Jenkins?
Here's the code which I'm trying to run in Jenkins
var ks = require('node-key-sender');
function test() {
ks.startBatch()
.batchTypeKey('a', 500)
.batchTypeKey('b', 500)
.batchTypeKey('c', 500)
.batchTypeKey('d', 500)
.batchTypeKey('e', 500)
.batchTypeKey('f', 500)
.batchTypeKey('g', 500)
.batchTypeKey('h', 7000)
.batchTypeKey('i', 2000)
.batchTypeKey('j', 500)
.batchTypeKey('k', 500)
.batchTypeKey('l', 500)
.batchTypeKey('y', 500)
.batchTypeKey('z', 500)
.sendBatch();
}
setTimeout(()=>{
console.log("starting");
test();
},1000)
note- The code does seem to run and output the line "starting". Irrespective of the place from which I ran it. ie. cmd/Jenkins. but it does not give keypresses when I run it using Jenkins.