python: How can I press arrow keys randomly selenium python: How can I press arrow keys randomly selenium python-3.x python-3.x

python: How can I press arrow keys randomly selenium


This seem to work. Try it and let me know the result:

from selenium.webdriver.common.keys import Keysimport randommoves = [Keys.LEFT, Keys.DOWN, Keys.RIGHT, Keys.UP]while True:    driver.find_element_by_css_selector('body').send_keys(random.choice(moves))