简体   繁体   English

如何使用Selenium Webdriver禁用键盘快捷键?

[英]How to disable keyboard shortcuts using Selenium webdriver?

I am using this piece of code the browser to press Ctrl + P to print.. 我正在使用这段代码在浏览器中按Ctrl + P进行打印。

String selectAll = Keys.chord(Keys.CONTROL, "p");
driver.findElement(By.className("link-box")).sendKeys(selectAll);

But I want to disable this on my browser. 但是我想在我的浏览器上禁用它。

You cannot disable keyboard OS shortcuts with Selenium. 您不能使用Selenium禁用键盘OS快捷键。

Selenium drives the browser, it does not interact with the OS. Selenium驱动浏览器,它不与操作系统交互。 If you want to disable OS shortcuts you will need to interact with the OS to do so, Selenium can't interact with the OS. 如果要禁用操作系统快捷方式,则需要与操作系统进行交互,Selenium无法与操作系统进行交互。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM