from selenium.webdriver.common.keys import Keys
from selenium import webdriver
driver = webdriver.Ie()
driver.get(' https://gabrielecirulli.github.io/2048/')
html = driver.find_element_by_tag_name('html')
for i in range(20):
html.send_keys(Keys.LEFT)
html.send_keys(Keys.DOWN)
html.send_keys(Keys.LEFT)
html.send_keys(Keys.DOWN)
html.send_keys(Keys.LEFT)
html.send_keys(Keys.DOWN)
html.send_keys(Keys.RIGHT)
html.send_keys(Keys.UP)
print("======第%d轮======"%i)
print("Done")
第11章:2048联系键盘上下左右键
最新推荐文章于 2023-02-20 19:55:29 发布