Robot.keyPress(KeyEvent.VK_META) // See: The only other way is via the Java AWT Robot class: Robot robot = new () However, JavaScript doesn't let you "just send keys". The most efficient way and non-platform-specific way to request a page reload is using JavaScript: ((JavascriptExecutor) driver).executeScript("(true)") Presumably this is down to differences in the implementations of the remote Keyboard implementation, which it's probably best not to rely upon. Use of the Selenium Actions class for Cmd- R works on my Mac in Firefox (45), but only when run in the foreground - and seemingly not at all in Chrome. The WebDriver spec is element-focussed, and doesn't define any method to send keys to the window, the screen, to browser chrome - only to elements.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |