If the print button is clicked, the print preview popup will display and the test case will remain stuck
This is because the print window you are seeing is not part of the website, it is part of the browser. Selenium/Katalon is unable to interact with it (if you were hoping you could simply switch to the new window in your script). If you search the forum you’ll see a few discussions. AutoIT is an app that can interact with windows apps for example. As printing is pretty standard though, are you sure you need it?
@Dan_Bown Yes sure i wanna interact with print just for clicking on the cancel button, so do you have any idea how can i integrate AutoIT with katalon ?!
hmmm, you might have to search for that - I know there are instructions on the forum.
You could try this though:
import java.awt.Robot as Robot import java.awt.Toolkit as Toolkit import java.awt.event.KeyEvent as KeyEvent
Then add this into your script. rather than clicking cancel - it hits escape key. Should be same effect:
Robot robot = new Robot() robot.keyPress(KeyEvent.VK_ESCAPE) robot.keyRelease(KeyEvent.VK_ESCAPE)
Note that if you are clicking ‘Print’ and then hitting ‘Escape’, you have no means to verify that the print dialog actually opened. Whereas clicking ‘Cancel’ proves that there is a cancel button there to click (but you might need AutoIT or similar to do that properly). Just a suggestion, others might have a better way