I’m using Chrome
How can I fix this ?
Its similar to a breakpoint.
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.
Hi @paudet
I am having the same issue now. were you able to resolve it? I just wanted to escape out of the print preview and switch back to the previous window. Please share if you were able to resolve. Thanks!
Hi Hamsika,
Could you note steps to reproduce or video record on the issues?
If a new tab is opened for the print view, try to move two windows index.
If your current index is 0, once the tab for print view is opened, move immediately to index 2
int currentTab = WebUI.getWindowIndex()
Event that open print view
WebUI.switchToWindowIndex(currentTab + 2)
If you want to close it, try with
WebUI.closeWindowIndex(currentTab + 1)
I get the same issue where it gets stuck in click step. The Chrome print window comes up, then the next step to WebUI.switchToWindowIndex() doesn’t get executed since it’s still stuck on the click step
I have not been able to resolve to this day. I just tried it again, same problem.