请问,老师
登陆页面通过press_keycode方式输入电话,但是有时候会重复输入,不知道为什么,例如我想输入15910312367,但是有时候数字会重复被输入,代码如和截图下图
def number_input(): element = driver.find_element_by_id("com.kangfuzi.lefthanddoctor:id/phone_nums") elements = element.find_elements_by_class_name("android.widget.TextView") print(len(elements)) print(elements) elements[0].click() driver.press_keycode(8) time.sleep(2) elements[1].click() driver.press_keycode(12) time.sleep(2) elements[2].click() driver.press_keycode(16) time.sleep(2) elements[3].click() driver.press_keycode(8) time.sleep(2) elements[4].click() driver.press_keycode(7) time.sleep(2) elements[5].click() driver.press_keycode(10) time.sleep(2) elements[6].click() driver.press_keycode(8) time.sleep(2) elements[7].click() driver.press_keycode(9) time.sleep(2) elements[8].click() driver.press_keycode(10) time.sleep(2) elements[9].click() driver.press_keycode(13) time.sleep(2) elements[10].click() driver.press_keycode(14)
实际想输入:
15910312367,
但是被输入了1151031223