我想验证 PDF 放大和缩小按钮,但似乎无法完成。我尝试在新选项卡中打开 PDF,然后进行验证,但这也不起作用。
检查时我可以看到一些标签和 div。
我尝试了差异。 xpath 如下:
//paper-fab[@aria-label='Zoom in']
//paper-feb
但是当我检查列表 webelement 时它总是返回零。
这里是示例 URL:
https://pdfobject.com/static.html
最佳答案
我建议您使用Sikuli :
Sikuli automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is useful when there is no easy access to a GUI's internal or source code.
我认为仅使用 Selenium 无法完成您想要的事情。如果需要集成Selenium和Sikuli,可以看SOF上的这篇帖子:Calling to a Sikuli script from Python (Selenium) 。它可以给你一些想法。然而,也许您可以阅读一些有关 Robot class 的内容。 .
我希望这会有所帮助。
关于java - 有没有办法使用selenium验证PDF放大/缩小按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51139959/