美文网首页
2048游戏自动刷分狗

2048游戏自动刷分狗

作者: brzhang | 来源:发表于2018-02-21 14:58 被阅读35次
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    import time
    
    browser = webdriver.Chrome()
    browser.get('https://gabrielecirulli.github.io/2048/')
    try:
        while True:
            htmlElem = browser.find_element_by_tag_name('body')
            time.sleep(0.2)
            htmlElem.send_keys(Keys.UP)
            time.sleep(0.3)
            htmlElem.send_keys(Keys.DOWN)
            time.sleep(0.4)
            htmlElem.send_keys(Keys.LEFT)
            time.sleep(0.5)
            htmlElem.send_keys(Keys.RIGHT)
    
    except:
        print('Was not able to find an element with that name.')
    

    相关文章

      网友评论

          本文标题:2048游戏自动刷分狗

          本文链接:https://www.haomeiwen.com/subject/jeqotftx.html