When make a click on print and open a pop up the test case stops

I’m using Chrome

How can I fix this ?

Its similar to a breakpoint.

wait.png

hi Clau,

while browsing website our default focus is on website, but when any dialog box pop ups we have to shift out focus to new window.

use WebUI.switchToWindowIndex(1)

for 1st pop use index as 1, for 2nd use index as 2 and so on… you can handle many pop up using this.

thanks and regards,
sanket gharat.

I am stuck at the same point the click event stays stuck. I tried what was suggested, it did not fix my problem.

@paudet Another option to use is to use the title of the pop-up, if it has one. If it does have a title, then copy the title right from the pop-up and paste it in the method parameter. An example is below:

WebUI.switchToWindowTitle(‘Decision Tree > HistoryList’)

After dealing with the pop-up, then move back to the main page by using:

WebUI.switchToDefaultContent()

This assumes it is a pop-up and not an Alert. If it is an Alert, then there are other methods for them.

Hello. thanks for answering me. The thing is that this popup has no title; it is the print popup of Chrome when a print button is clicked on the page.

@paudet How about trying some of the Alert methods, like:

verifyAlertPresent (int timeOut)

acceptAlert ()

dismissAlert ()

waitForAlert (int timeOut)

Yes I have tried those too already, it won’t work. I have also tried the robot() and sending the VK_ESCAPE key or VK_ENTER key too, nothing works.

The thing is it never gets passed the “click”. it stays stuck, it does not go to the next check. Have you tried it ?

I tried this and it working for my certain print button

WebUI.click(findTestObject(‘Page Title/button_Print’), FailureHandling.STOP_ON_FAILURE)

‘Close print window’
WebUI.closeWindowIndex(1)

‘Optional’
WebUI.delay(2)

‘switch to main tab’
WebUI.switchToWindowIndex(0)

Mine hangs on the click(). It waits for something it doesn’t even go to my next command which is one of those suggestions here like WebUI.closeWindowsIndex or other. But if I manually click the cancel on the print dialog, then the test case resumes and tries to do WebUI.closeWindowIndex(1) and the following commands.