问题描述
我需要按 + .
第一次尝试时,我尝试通过 使用 sikuli
At first attempt I have tried with sikuli by :-
s1.type(Key.WIN + Key.UP);
但是它只按下和按钮,但分开.
But it only press and buttons, but separately.
通过硒,我尝试了Actions类,但是我发现那里没有可用的键可以按按钮.
By selenium I have try with Actions class but I have found there is no key available to press button there.
推荐答案
在sikuli中,如果您想模拟按住一个按钮,然后键入另一个按钮,请使用type(TheKeyDoingTheAction, KeyModifier.TheKeyYoureHoldingDown.它的写法是这样的:
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
这是 sikuli文档的摘录:
"如果需要多个键修饰符,可以使用"+"或"|"将修饰符常数组合到修饰符参数上.
"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)
它们仅应在带有type(),rightClick()等函数的修饰符参数中使用.绝对不要将它们与keyDown()或keyUp()一起使用."
They should only be used in the modifiers parameter with functions like type(), rightClick(), etc.They should never be used with keyDown() or keyUp()."
这篇关于如何使用Sikuli或Selenium同时按下[WINDOW] + [UpArrow]键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!