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
• 7,870 points
1,206 views

1 answer to this question.

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,420 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
815 views
0 votes
1 answer

How to do session handling in Selenium Webdriver?

Hey Lalita, you can perform following steps ...READ MORE

answered Jun 20 in Selenium by Subhash
256 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,090 points
592 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
901 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
579 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,420 points
643 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,420 points
1,747 views