Ready-made starting points for common logins and automations. Copy a template, swap in your own selectors and credentials, and adjust the pauses to suit the site.
Before you use these:
The selectors below are examples. Login pages change their HTML often, so copy your own current selectors from the live page using the Selectors steps.
Always mask your credentials before you save. Do not leave a password in plain text.
If the service requires multi-factor authentication (MFA), an unattended script cannot complete the login. See the Scripting FAQ for alternatives.
Generic login (most websites)
A reusable starting point for a standard email-and-password form. Many sites need an event fired after typing so the field registers the value, which is why the runScript block is included.
type("""email_css_selector""", """YOUR_EMAIL""")
pause(1)
type("""password_css_selector""", """YOUR_PASSWORD""")
pause(1)
runScript("""
document.querySelector("email_css_selector").dispatchEvent(new Event("input", { bubbles: true }))
document.querySelector("password_css_selector").dispatchEvent(new Event("input", { bubbles: true }))
""")
pause(1)
clickAndWait("""login_button_css_selector""")
If the form is built with React, use the React variant in the Scripting FAQ instead.
Microsoft account / Microsoft 365
Signs in through Microsoft's login flow: email, then password, then the "Stay signed in?" prompt.
Webpage: https://login.microsoftonline.com/
type("""#i0116""", """YOUR_EMAIL""")
pause(1)
runScript("""
document.querySelector("#i0116").dispatchEvent(new Event("change"))
""")
pause(2)
click("""#idSIButton9""")
pause(2)
type("""#i0118""", """YOUR_PASSWORD""")
pause(1)
runScript("""
document.querySelector("#i0118").dispatchEvent(new Event("change"))
""")
pause(2)
clickAndWait("""#idSIButton9""")
click("""#KmsiCheckboxField""")
pause(2)
click("""#idSIButton9""")
The final three lines handle the "Stay signed in?" screen. If your tenant does not show that screen, you can remove them.
Google account
Signs in through Google's login flow: email, then password.
Google may require MFA or block automated logins. Treat this as a pattern, supply your own current selectors for the password field and the buttons, and mask your credentials.
Webpage: https://accounts.google.com/ServiceLogin
pause(2)
type("""#identifierId""", """YOUR_EMAIL""")
pause(1)
click("""#identifierNext""")
pause(2)
type("""password_field_selector""", """YOUR_PASSWORD""")
pause(1)
clickAndWait("""next_button_selector""")
pause(2)
Related articles
Scripting Engine Reference — full command and syntax reference
Scripting FAQ — fixes for logins that do not register, MFA, blank pages and more
Useful Scripts To Use — scrolling, hiding elements, CSS injection and more
Mask your credentials at the Scripting Engine text field — keep passwords out of plain text