java - 有没有办法使用selenium验证PDF放大/缩小按钮?

标签 java pdf selenium-webdriver

我想验证 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/

相关文章:

java - Eclipse 插件开发找出 CompilationUnit 属于哪个工作集

html - HTML 到 PDF 转换的规范?

java - 有条件地分配变量以匹配 xslt 模板中的路径

python - 无法处理一些关键的链接

java - not() 和 ends-with() 的 Xpath 错误

java - android中的MemoryFile有什么用

java - 无法让 JPanel 在 Swing 中正确调整大小

java - 使用Servlet在浏览器中显示Pdf文件

java - Java 中使用 if else 逻辑的自动化测试流程

java - 用户输入 Ctrl+Z 时终止 Java 程序