lundi 3 avril 2017

i am totally new to python please if anyone can solve this issue

driver.find_element_by_id("uname").send_keys("admin")
driver.find_element_by_id("pwd").send_keys("admin")
driver.find_element_by_xpath('//*[@id="login_form"]/div/button').click()
//below xpath is code for invalid user id or password message
if driver.find_element_by_xpath('//*[@id="login_form"]/div[1]').is_displayed():
    output=open("OutputAdmin","w+")
    output.write("Login unsuccessful")
    output.close()
else:
    output = open("OutputAdmin", "w+")
    output.write("Login successful")
    output.close()
driver.quit()

now if user id or password is incorrect it is working fine but if they are correct it doesn't execute else code.

Aucun commentaire:

Enregistrer un commentaire