This is a migrated thread and some comments may be shown as answers.

Windows Printing

1 Answer 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
G
Top achievements
Rank 1
Veteran
G asked on 08 Jul 2020, 11:35 AM

Dear Telerik Test Studio Team,

We use Silverlight and so we can't access the windows printer dialog which opens, to select an PDF printer.
Do you have any suggestions?

 

 

Regards

Gina 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 09 Jul 2020, 11:40 AM

Hello Gina,

The Windows Printer Dialog is actually a Windows dialog and not part of the application under test. As a result, Test Studio does not "see" it and can't record actions against this dialog. You can still automate this test scenario, by following the steps below.

  1. You need to configure this window to have the expected selections and options outside of the test automation, as a precondition. Set the default printer and other settings that you want and apply them. Those should be saved on your machine and the next time this dialog is opened, they should be already set.
  2. Add an execution delay after you click on the button, that brings up the print dialog.
  3. Add a coded step after the delay and configure it to press the Enter key from the Keyboard Manager. You need to add a reference to System.Windows.Forms to your project and coded step. See the sample code below.
    Manager.Desktop.KeyBoard.KeyPress(Keys.Enter, 200);
  4. If you need to handle another dialog, which saves the PDF file to a specified location, you might need to add another execution delay and then press Enter key again in a coded step.

I remain available to advise you further and explore the behavior after the suggested steps.

Regards,
Plamen Mitrev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
G
Top achievements
Rank 1
Veteran
Answers by
Plamen Mitrev
Telerik team
Share this question
or