Advertisement
Guest User

Untitled

a guest
Feb 28th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. login_attempt = driver.find_element_by_xpath("//*['Please log on to use the Broadband Service.']") # It can be any Other Custom Message. So replace it. Example: 'Login to your profile.''
  2. username = driver.find_element_by_id("inputUsername") # It's the HTML Form Input ID of your Username. Replace it.
  3. password = driver.find_element_by_id("inputPassword") # It's the HTML Form Input ID of your Password. Replace it too.
  4. username.send_keys("YOUR_USERNAME_HERE") # Replace this with your own Username.
  5. password.send_keys("YOUR_PASSWORD_HERE") # Replace this with your own Password.
  6. login_attempt = driver.find_element_by_xpath("//*[@type='submit']")
  7. login_attempt.submit()
  8. assert "You are logged in successfully." in driver.page_source # Asserts that you have logged in successfully and prints a custom message.
  9. print("You're successfully logged in.")
  10. time.sleep(5)
  11. driver.close() # Closes the browser window.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement