Handling print dialog in Selenium WebDriver

0 votes

I have to handle print dialog, which appears by clicking [CLTR+P] inside the browser). 

I tried it using the below code:

Alert print = driver.switchTo().alert();
print.dismiss();

But this code was not working for me. How to handle these objects?

May 11, 2018 in Selenium by ana1504.k
• 6,630 points
740 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

In Selenium WebDriver we are not able to handle these. 

Alos, they are different across different Browsers/ Systems/ Programming Language settings, that's why there is no definite answer to this question.

It would be better if you can avoid the print dialog and try to take the screenshot of the page and print it using the Java tools.

answered May 11, 2018 by Meci Matt
• 9,400 points

Related Questions In Selenium

0 votes
1 answer

Handling JavaScript Alert window in Selenium WebDriver

You should try using waits for alerts ...READ MORE

answered Apr 10, 2018 in Selenium by ghost
• 1,790 points
633 views
0 votes
3 answers

How to specify "ENTER" button functionality in Selenium WebDriver code?

using OpenQA.Selenium.Interactions; Actions builder = new Actions(driver); ...READ MORE

answered Feb 12 in Selenium by anonymous
5,187 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
1,382 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
130 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
519 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
118 views
0 votes
1 answer

Handling pop up in Chrome using Selenium WebDriver

AutoIt Window Information Tool do not recognize ...READ MORE

answered Jun 11, 2018 in Selenium by Meci Matt
• 9,400 points
482 views
0 votes
1 answer

Handling elements inside Shadow DOM in Selenium WebDriver

You can use the driver.executeScript() method to access the ...READ MORE

answered Jun 11, 2018 in Selenium by Meci Matt
• 9,400 points
1,158 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.