简体   繁体   English

我需要处理打印预览应用程序对话框。 但我无法用 Selenium C# 做到这一点。 我该怎么做? 打印预览在另一个选项卡中打开

[英]I Need to handle Print Preview App Dialog Box. But I am not able to do that with Selenium C#. How can I do it? The Print Preview opens in another tab

I am trying to handle a Print Dialog in Chrome.我正在尝试在 Chrome 中处理打印对话框。 But, Selenium is not able to interacts with it.但是,Selenium 无法与之交互。 Is it possible that I click on the Print Hyperlink, instead of opening the new tab with Print Dialog box, it Saves the next page content as PDF with required settings?是否可以单击打印超链接,而不是使用打印对话框打开新选项卡,它将下一页内容保存为 PDF 并具有所需的设置?

Or if I can somehow interact with the Print Dialog in Selenium or C#?或者,如果我能以某种方式与 Selenium 或 C# 中的打印对话框进行交互? enter image description here在此处输入图像描述

You can use Action class in selenium to send keys to browser.您可以使用 selenium 中的Action class 将密钥发送到浏览器。 If you want to cancel then send "Esc" else send "Enter" to save.如果要取消,则发送“Esc”,否则发送“Enter”以保存。 After pressing save, save as dialog will appear which you can handle using AutoIt .按保存后,将出现另存为对话框,您可以使用AutoIt处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM