简体   繁体   English

如何使用Java和Selenium Web驱动程序单击CTRL + P?

[英]How to click CTRL+P using Java and selenium web driver?

I am unable to send keyboard entry as CTRL+P using selenium. 我无法使用硒将键盘输入作为CTRL + P发送。 Please help. 请帮忙。

My code looks like below: getWebElement("Registration").sendKeys(Keys.chord(Keys.CONTROL, "p")); 我的代码如下:getWebElement(“ Registration”)。sendKeys(Keys.chord(Keys.CONTROL,“ p”));

I have tried CTRL+A with the same code and it works without any issues. 我用相同的代码尝试过CTRL + A,它可以正常工作。

如果您要打印,这对我有用

((JavascriptExecutor) driver).executeScript("print()");

Try with actions 尝试行动

Actions actions = new Actions(driver);
actions.sendKeys(Keys.chord(Keys.LEFT_CONTROL, "p")).build().perform();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Java中使用Selenium Web驱动程序单击复选框? - How do I click on checkbox using selenium web driver in Java? 如何使用Java Selenium Web驱动程序强制单击按钮 - How to click on a button with force using java selenium web driver 在Selenium Web驱动程序中使用Java脚本执行程序单击列表项 - click on list items using java script executor in selenium web driver 如何使用Java在Selenium Web驱动程序中选择并单击单选按钮 - How to select and click on a radio button in selenium web driver with java 如何使用Selenium Web Driver Java单击具有某些单词作为文本的href - How to click on one href which has certain words as text using selenium web driver java 如何切换到框架并使用Web驱动程序(Selenium-Java)单击弹出窗口? - How do I switch to a Frame and click on the pop up using web driver (Selenium - Java)? Selenium Web驱动程序/ Java /悬停+单击 - Selenium web driver / java / hover + click 通过JSSC通过串行发送Ctrl + P - Send Ctrl+P through serial with JSSC 如何使用Selenium Web驱动程序单击导航栏 - How to click on navigation bar using selenium web driver 如何在 Java 中使用 selenium web 驱动程序查找突出显示的文本? - How to find the highlighted text using selenium web driver in Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM