Winium.Desktop
Winium.Desktop copied to clipboard
automate Fn keys
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
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
}
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.
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 - 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?
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 %