Skip to content

Instantly share code, notes, and snippets.

@pranshuj73
Last active April 26, 2020 00:01
Show Gist options
  • Save pranshuj73/a496cde7417a84d57217f5b1faeb861f to your computer and use it in GitHub Desktop.
Save pranshuj73/a496cde7417a84d57217f5b1faeb861f to your computer and use it in GitHub Desktop.
code section 2
# everything here is a part of login function of Tweeter class
# Now we need to find the field where we want to type in the username/email
uname_field = driver.find_element_by_name("session[username_or_email]")
# typing the username
# Note: it's important to press tab using Keys.TAB after typing the username
# to switch to the password field (or we can add extra lines of code to click on it)
uname_field.send_keys(username, Keys.TAB)
# selecting the password field
pass_field = driver.find_element_by_name("session[password]")
# typing the password and pressing enter key using Keys.RETURN to submit everything
pass_field.send_keys(password, Keys.RETURN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment