How to press [WINDOW] + [UpArrow] keys together, using Sikuli or Selenium

我是研究僧i 提交于 2019-12-08 04:05:20

问题


I need to press WINDOW + UpArrow.

At first attempt I have tried with sikuli by :-

s1.type(Key.WIN + Key.UP);

But it only press WINDOW and UpArrow buttons, but separately.

By selenium I have try with Actions class but I have found there is no key available to press WINDOW button there.


回答1:


In sikuli, if you want to simulate pressing and holding one button, while then typing another, use type(TheKeyDoingTheAction, KeyModifier.TheKeyYoureHoldingDown It's written like this:

type(Key.UP, KeyModifier.WIN) #This is the one from your question

Here are a few other common examples:

type("c", KeyModifier.CTRL) #copies whatever is selected to the clipboard
type(Key.LEFT, KeyModifier.ALT) #goes back one page in most web browsers

Here's an exerpt from the sikuli docs:

"The modifier constants can be combined to the modifier parameter by either using “+” or “|”, if more than one key modifier is needed.

type(Key.ESC, KeyModifier.CTRL + KeyModifier.ALT)
# or equivalent -
type(Key.ESC, KeyModifier.CTRL | KeyModifier.ALT)

They should only be used in the modifiers parameter with functions like type(), rightClick(), etc. They should never be used with keyDown() or keyUp()."



来源:https://stackoverflow.com/questions/26281027/how-to-press-window-uparrow-keys-together-using-sikuli-or-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!