如何使用Sikuli或Selenium一起按 + 键

我需要按WINDOW + UpArrow

在第一次尝试时,我尝试过sikuli : –

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

但它只按WINDOWUpArrow按钮, 但是分开

通过selenium我尝试使用Actions类,但我发现没有键可用于按下WINDOW按钮。

在sikuli,如果你想模拟按住一个按钮,然后输入另一个按钮,使用type(TheKeyDoingTheAction, KeyModifier.TheKeyYoureHoldingDown它是这样写的:

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

以下是一些其他常见示例:

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

这是sikuli文档的一个例外 :

“如果需要多个键修饰符,可以使用”+“或”|“将修饰符常量组合到修饰符参数。

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

它们只能在modifiers参数中使用,类型为type(),rightClick()等。它们永远不能与keyDown()或keyUp()一起使用。“