0

I would like to print pages after each click in Chrome. So script should perform a click and after that send "CTRL+P" to open printing dialog and "ENTER" to save page as PDF file by default.

plaidshirt
  • 5,189
  • 19
  • 91
  • 181

1 Answers1

0

I got solution on Katalon forum: https://forum.katalon.com/discussion/9776/send-keys-to-browser-dialog-windows It is based on Java Robot class.

Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL)
robot.keyPress(KeyEvent.VK_P)
// CTRL+P is now pressed 

robot.keyRelease(KeyEvent.VK_P)
robot.keyRelease(KeyEvent.VK_CONTROL)
// CTRL+P is now released
plaidshirt
  • 5,189
  • 19
  • 91
  • 181