Closing a print dialog

652 views
Skip to first unread message

adam.burley

unread,
Mar 11, 2010, 1:22:09 PM3/11/10
to webdriver
Hi,

I am using WebDriver to test one of my printable views - this is a
popup which automatically opens a print dialog using a JavaScript
window.print call. Is there any way to automatically close this dialog
using WebDriver? Or alternatively is there some way to forcibly close
the popup window at the end of the test - driver.close doesn't seem to
work if there is a print dialog open. I can't have loads of orphaned
WebDriver browser windows with print dialogs left open on my CI
server.

Thanks
Adam.

Simon Stewart

unread,
Mar 14, 2010, 12:21:56 PM3/14/10
to webd...@googlegroups.com
Hi,

Right now there's no way to remove the print dialog when using
webdriver. One solution would be to override the "window.print" method
using a JavascriptExecutor to do nothing, though if you're calling
this function from the onload handler you may not have time to do
that.

The "close" method only closes a single window. Try using "quit" instead.

Regards,

Simon

> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages