SoFunction
Updated on 2025-03-02

selenium+python input processing method for input boxes

Recently, I have been doing automated testing of the project (the company does not have this requirement). When the user management module modified the user information, the script had been successfully run and did update operation. However, I logged into the page to check, but the information was not modified. I again confirmed that the editing function of the module of the system is available. The script is as follows:

if result_num>1:   
print "Begin to change user infomations"   
driver.find_element_by_xpath("//*[@id='tbodyUserInfo']/tr/td[8]/img[2]").click()   
driver.implicitly_wait(15)   
driver.find_element_by_id("uname").clear()   
driver.find_element_by_id("uname").send_keys("MoondyLi")   
driver.find_element_by_id("truename").clear()   
driver.find_element_by_id("truename").send_keys("chenchen")   
driver.find_element_by_id("updateUser").click()

No matter how you look at it, you feel that the script is not a problem, and after taking the screenshot, you did do the input operation. Later, after recording the process using the selenium IDE, Firefox, it was found that the automated script recorded by the tool had one more step:

driver.find_element_by_id("uname").click()     

#First click on the input box of the input text

After adding this step, the script successfully modified the data.

The above article selenium+python input processing method for input boxes is all the content I share with you. I hope you can give you a reference and I hope you can support me more.