另存为PDF Chrome使用硒 [英] Save As PDF Chrome using selenium
问题描述
我正在寻找使用硒自动化另存为PDF的Chrome。 AFAIK并不支持Selenium开箱即用。因此,我正在努力写我自己的。我有问题。实际上,点击我的网页上的打印按钮打开一个可打印区域的新窗口。我正在尝试使用SwitchTo切换到此窗口。但它总是超时。
I am looking to automate "Save as PDF" of Chrome using selenium. AFAIK it is not supported by the Selenium out of the box. Therefore, i am trying to write my own. I am having an issue. Actually clicking on the Print button in my webpage opens a new window with printable area. I am trying to switch to this window using SwitchTo. But it is timing out always.
推荐答案
您可以添加options.AddArgument( - kiosk-printing);让它自动点击打印按钮。
You can add the options.AddArgument("--kiosk-printing"); to have it automatically click the print button.
这对我很有用,但我在将打印机设置为另存为PDF时遇到问题。它正在打印到打印机。
That is working for me but I have a problem setting the printer to Save as PDF. It is printing to the printer instead.
这篇关于另存为PDF Chrome使用硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!