模拟登陆,输入账号密码停顿,一个一个输入,问题解决

# 模拟输入
def _input_simulation(e, text):
    for i in range(len(text)):
        sleep_time = random.randint(8, 30)
        time.sleep(sleep_time / 10)
        e.send_keys(text[i])
    
        # 输入账号密码
        print ('输入账号密码')
        static_button = device.find_element_by_id('J_Quick2Static')
        static_button.click()
        time.sleep(random.uniform(0.5, 2))
        _input_simulation(device.find_element_by_id('TPL_username_1'), get_username())
        time.sleep(random.uniform(0.5, 2))
        # browser.find_element_by_id('TPL_password_1').send_keys('yh86047659')
        _input_simulation(device.find_element_by_id('TPL_password_1'), get_password())

原文作者,github地址:https://github.com/iQuick/TB-Crawler/blob/master/tb_login.py

你可能感兴趣的:(python)