I wanted to implement equivallent of the CRTL + / - key press in Chrome as buttons in nuBuilder (Chrome zoom in /out)
so trying to implement some function as in the following link:
https://blog.softhints.com/java-robot-k ... and-click/
I prepared the function placed in custome code JS:
- Code: Select all
public static void zoom_plus(Robot r){
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_PLUS);
r.delay(1000);
r.keyRelease(KeyEvent.VK_CONTROL);
r.keyRelease(KeyEvent.VK_PLUS);
}
and later in button onclick I am trying to run it with: zoom_plus();
but does not work with following error:
- Code: Select all
Uncaught TypeError: Cannot read property 'keyPress' of undefined
at zoom_plus (<anonymous>:61:7)
at HTMLInputElement.onclick (index.php:1)
Do you you have some suggestions how to progress with it?