editbox = driver.find_element_by_id("id") editbox.click() content = editbox.get_attribute("text") driver.keyevent(123)#光标定位到末尾 for i in range(0,len(content)): driver.keyevent(67)#backspace