Winium.Desktop icon indicating copy to clipboard operation
Winium.Desktop copied to clipboard

automate Fn keys

Open mikeliucc opened this issue 8 years ago • 4 comments

Hi,

Would it be possible to send function keys (F1, F2, etc.), with combination of Shift, Control or Alt, to the application under test?

Some code example would be great! Thank you

mikeliucc avatar Dec 02 '16 06:12 mikeliucc

Yes, by using Robot..

@Test public void test() throws InterruptedException, AWTException { Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ALT); //holds down Alt key robot.keyPress(KeyEvent.VK_F4); //Press F4 robot.keyRelease(KeyEvent.VK_ALT); //release Alt key

}

amankk avatar Mar 06 '17 05:03 amankk

Hi guys, I was trying to send some simple commands of the keyboards. letters and numbers are correctly recognized, when i have to use keys like Enter, ALT, or similar(FXX), Winium is not able to recognize it and send "?"(can you check in the log below)

Another strange thing that I've noticed, is that for each command sent, is sent always the combination of CTRL+A and after that a back key. After this two operations, our argument in sendkeys, has been sent.

immagine

12:48:21 [DEBUG] Waiting for a connection... 12:48:21 [DEBUG] ACCEPTED REQUEST POST /session/AwesomeSession/element/1574460-1/value HTTP/1.1 12:48:21 [INFO] COMMAND sendKeysToElement { "id": "1574460-1", "value": [ "?" ], "SESSIONID": "AwesomeSession", "ID": "1574460-1" } 12:48:22 [INFO] Click on 'type: ControlType.Window, name: cliente - Blocco note' element at (956, 519) ClickablePoint 12:48:22 [INFO] Press key combo 'CONTROL + VK_A' 12:48:22 [INFO] Key press 'BACK' 12:48:22 [INFO] Send text '?' 12:48:22 [DEBUG] RESPONSE: OK: { "sessionId": "AwesomeSession", "status": 0, "value": null }

Can you help or i have to move to other tools?

Thanks, Giuseppe

gmdellarte avatar Feb 14 '18 12:02 gmdellarte

@gmdellarte - did you get any solution for your above query? -Do we have support for drag and drop for winium desktop driver? -Is it possible to handle tree in winium deskop driver?

Do you still use winium or switch to another tool?

truptibhatt avatar Oct 08 '18 12:10 truptibhatt

To simulate key press of Function keys. .... DesktopOptions options = new DesktopOptions(); options.setKeyboardSimulator(KeyboardSimulatorType.BasedOnWindowsFormsSendKeysClass); ... then.. elemnt.sendKeys("{F10}"); ..

If need to press, Control+t, then.. elemnt.sendKeys("^t");

alt would be %

sindhua25 avatar Aug 12 '20 21:08 sindhua25