inputing "up" & "down" keys from the keyboard in monkeyrunne - monkeyrunner

I am currently testing an application on Android platform using Monkeyrunner & python script. I want to know if there is any way to input the up & down keys from the keyboard using the device.press command.
I looked at the entire list of key events given in
http://developer.android.com/reference/android/view/KeyEvent.html
but couldnt find an option to press the up-down keys.
Any suggestions ??

You could use KEYCODE_DPAD_UP and KEYCODE_DPAD_DOWN. It's the same as pressing the up and down arrow keys on the keyboard. I used them in some of my tests.

Related

Click element, hold Shift key and click another element in robotframework

I need to be able to click an element on a webpage and hold the Shift key on keyboard and press another element.
Can I implement this behaviour using "Press Key" in Selenium2Library?
You can try to achieve your scenario using AutoItLibrary
First you need to install win32com.client, use below command
pip install pypiwin32
Then use AutoItLibrary command like as per your requirement
Send | {SHIFTDOWN}
For more info visit here
Use using Pyautogui library. This library simulates the User Actions on GUI such as Mouse Control, Keyboards inputs,etc. You can find details at
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjN1ZbrocrSAhWIFJQKHXbiBGcQFggbMAA&url=https%3A%2F%2Fpyautogui.readthedocs.io%2F&usg=AFQjCNEe5LY5eMdaquVD421_u-mpoFUOYQ&sig2=Lj-e4YldvbLNEvPe4NFHrA
Also U can install this library using pip by following keywords in following docs
http://pyautogui.readthedocs.io/en/latest/install.html

Simulate key presses with Robot Framework

We've defined the key-press sequence Ctrl + S in our web application to a specific action (save the current form).
Now we want to test that behavior with Robot Framework. How can we describe that accurately to do that?
The documentation describes how to use Enter or any single key press, but nothing is said about combinations. So how to trigger a Ctrl + S, for instance?
I was looking for the same and came across this. It says it is under implementation. Follow this for more update.
https://github.com/robotframework/Selenium2Library/issues/498
Lets hope it will be available to use by Oct-2015.
I found a solution with the ImageHorizonLibrary:
http://eficode.github.io/robotframework-imagehorizonlibrary/doc/ImageHorizonLibrary.html#Press%20Combination
Press Combination Key.CTRL Key.S
Here in the documentation you have examples of multiple keys pressed :
Press Keys locator CTRL+S

Returning from the '+' to '>' prompt in command line of R Studio

I know the prompt changes from < to + when the command line in R expects you to complete the current command. Is there a way (say, shortcut key) to immediately terminate the command being written and revert from the '+' mode to the regular console '>'?
Press 'Esc' key will bring you back to the prompt (<). You don't need to type word 'Esc'.
I suspect you are using a usb keyboard that has chromatic color controls via software. It sometimes mess up the keys therefore simply do a factory reset of your keyboard via install software. Then pressing "Esc" will revert to the
"greater than sign"

Any keyboard shortcut to display Xcode's "Show Find Options"?

Xcode offers several key codes to open the Find (CMD-F) or Find and Replace (CMD-OPT-F) editor toolbar, but how can I get the Find Options to show without having to move my mouse over the magnifying glass and clicking (which takes forever, I misclick, and then have to select the menu item - ugh)?
I have not found a single key to do this, but just discovered that after using
CMD-F
or
CMD-OPT-F
that the Find search field has focus, and by tapping the
down arrow key
twice followed by a
Return key, that it opened (do again to close)!
I added a key code sequence to Butler so I can use a single key to do this, so use your favorite Macro program to do likewise.
EDIT: Just discovered this still works in Xcode 7, you just need to do 2 down-arrows followed by a return.

How do I set alternate keys for a given command?

Preferences is bound to command+, by default. Suppose I want to add an additional key binding so that F2 (for example) also binds to Preferences? It must be possible because a few of the standard commands have alternate keystrokes.
According to the docs this is possible, but only with text commands.
"To add a sequence to an existing one, click the Add (+) button and type the new sequence. This only works for text commands; you cannot assign more than one sequence to a menu command."
You can find that in "Xcode 4.2 Developer Lbrary / Tools & Languages / IDEs / Key Bindings Preferences Help / Customizing Keyboard Shortcuts"

Resources