首页 > 解决方案 > python selnium网站登录除了问题

问题描述

错误信息不打印是什么问题?ㅠㅠㅠㅠ

 uid = id
 upw = pw

try:  
            driver.find_element_by_xpath('//*[@id="userID"]').send_keys(uid)  
            action.reset_actions()
            driver.find_element_by_xpath('//*[@id="userPWD"]').send_keys(upw) 
            driver.find_element_by_xpath('//*[@id="btnLogin"]').click() 
        except Exception as e: 
                print("{} 계정 로그인이 실패하였습니다.".format(uid))

标签: pythonpandasseleniumselenium-webdrivertry-catch

解决方案


为了打印异常,您需要实际打印 e,而不是 uid:

.....
except Exception as e: 
    print("{} 계정 로그인이 실패하였습니다.".format(uid))
    print(e)

推荐阅读