![](/img/trans.png)
[英]Which Selenium method or command can be used to click on the following buttons?
[英]Can selenium be used to click on print and then save as pdf?
我正在尝试以PDF格式下载许多受密码保护的网址。 我使用硒访问它们,但是我所有的html至pdf努力最终要么破坏了最终pdf中的格式,要么不保留字符集。 可以在浏览器中使用硒右键单击以pdf格式保存吗?
可以使用Actions类在Selenium Web驱动程序中右键单击动作。 右键单击操作在Selenium中也称为“上下文单击”。 Actions类提供的预定义方法上下文单击用于执行右键单击操作。 下面的代码演示了使用Actions类的右键单击操作。
Actions actions = new Actions(driver);
WebElement elementLocator = driver.findElement(By.id("ID"));
actions.contextClick(elementLocator).perform();
Actions类用于您可能需要的任何特殊输入,以使用键盘或鼠标在页面上执行操作来模拟真实用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.