Search This Blog

Thursday, January 31, 2013

#MonkeyRunner : Delete Text on EditText

Now my job is about writing script for doing auto-testing using Monkey runner.
I found the way to delete text that has been entered inside Edittext. Here is the code ...

    # Max text length
    fieldLength = 100
    

    # Select all the chars on the right
    dev.press('KEYCODE_SHIFT_RIGHT', MonkeyDevice.DOWN)
    for i in range(fieldLength):
             dev.press('KEYCODE_DPAD_RIGHT', MonkeyDevice.DOWN_AND_UP)
         #MonkeyRunner.sleep(1)
      dev.press('KEYCODE_SHIFT_RIGHT', MonkeyDevice.UP)
    # Delete them
    dev.press('KEYCODE_DEL', MonkeyDevice.DOWN_AND_UP)
   
    # Select all the chars on the left
    dev.press('KEYCODE_SHIFT_LEFT', MonkeyDevice.DOWN)
    for i in range(fieldLength):
             dev.press('KEYCODE_DPAD_LEFT', MonkeyDevice.DOWN_AND_UP)
         #MonkeyRunner.sleep(1)
      dev.press('KEYCODE_SHIFT_LEFT', MonkeyDevice.UP)
    # Delete them
    dev.press('KEYCODE_DEL', MonkeyDevice.DOWN_AND_UP)


By running above script, it will select text and drag to the right then delete it. Afterthat it will select text and drag to the left and delete to make sure all text is clear.

Hope it helps...

Wednesday, January 16, 2013

How to Unlock Angry Birds:StarWars [Path of the Jedi] for FREE !!

Surely, I am a StarWars fanboy and I love playing Angry Birds. With all my Force I had spend, now I clear all free stages(with all 3 stars) and suddenly, I just realized that 'Path of the Jedi'  was unlocked !!  The Force is strong with me ...








*** all screenshots are Rovio Entertainment's property.