How can let Selenium to operate at the Broswer Print Dialog?

848 views
Skip to first unread message

TayLin

unread,
Apr 21, 2022, 11:58:11 PM4/21/22
to Selenium Users
Hi Guys, I got a problem.
When I was using Selenium, 
there was a Print Dialog jump out from the Chrome,

``` driver.switch_to.window(driver.window_handles[1]) ```

By using this code, I can switch the handles which is that Print Dialog.
But it just can't do anything.

Such as ,
find some element to click , use ActionChains to send Keys.ESCAPE.
anything were not working.
How can I do.

For the thing I need,
I just need to click the Cancel Print button , 
Or ActionChains send Keys.ESCAPE to close the Print Dialog.

OOR, is there other ways to do?

Using Version: Selenium 4.1.3 / Python 3.10.3

Thanks All Of You

Chris Carman

unread,
Apr 24, 2022, 4:01:53 AM4/24/22
to Selenium Users
You can't do this with Selenium, because the print dialog is a windows dialog, not a browser dialog.
There are other tools that can interact with the print dialog (e.g. AutoIt).

Dushyant Dandgawal

unread,
Apr 24, 2022, 6:08:53 AM4/24/22
to Selenium Users
Hello,

You may find your solution from below link:
Reply all
Reply to author
Forward
0 new messages