无法通过硒Web驱动程序访问打印按钮,因为它在shadow-root中

问题描述 投票:0回答:1

enter image description here有一种情况,我正在尝试通过Selenium Webdriver(Java)进行自动化并遇到麻烦。无法通过硒访问打印预览,因为它在影子根目录中。我们的任务是从门户网站下载pdf文件。当我们单击网络上的打印按钮时,将打开打印预览窗口,我们需要在此打印预览窗口中单击保存按钮才能下载pdf。并且还链接了我尝试解决此问题的解决方案的URL。截图enter image description here

https://www.seleniumeasy.com/selenium-tutorials/accessing-shadow-dom-elements-with-webdriverHow to interact with the elements within #shadow-root (open) while Clearing Browsing Data of Chrome Browser using cssSelectorHandle Print Preview window using selenium in chrome latest versionHow can I tell Selenium to press cancel on a print popup?Selenium how to click Ctrl + pHow to click on the print button on a web page using Selenium

selenium selenium-webdriver robotframework ui-automation autoit
1个回答
0
投票

尝试使用鼠标/键盘操作库:

Library           pyautogui
Library           ImageHorizonLibrary

检查关键字:

pyautogui.Key Down  'enter'
ImageHorizonLibrary.Press Combination   Key.enter

上面的库还有其他应该有用的关键字。

© www.soinside.com 2019 - 2024. All rights reserved.