dimanche 5 février 2017

python: How can I press arrow keys randomly selenium

I am trying to make a program which plays 2048 by randomly choosing arrow keys.

I tried something like this:

 moves = [htmlElem.send_keys(Keys.UP),htmlElem.send_keys(Keys.RIGHT),htmlElem.send_keys(Keys.DOWN),htmlElem.send_keys(Keys.LEFT)]


while True:
    random.choice(moves)

This is not working. I tried print(random.choice(moves)), but it infinite loop of None

So how can I press arrows keys randomly using Selenium?




Aucun commentaire:

Enregistrer un commentaire