Check if a website needs a login and log in only when it does


How to check if a website needs a login and log in only when it does: install the Chrome extension, click Build with Browser agent, tell the agent what you want, and follow its prompts. A working bot is built and tested in minutes.

Here is how the automation works. To check if a website needs a login, open the site with Go to page, read where you landed with Get current bot URL, and use an If condition step to look for a word such as login in it. When the word is there, the steps inside the If condition enter your email and password and click the login button; when it is not, the automation carries on as it is.

Author
Alex Barlow
Published

Build the login check from a description


Describe it and click the button: the agent builds and tests the login check in your Chrome extension. It works on any site where you already know what the login page looks like; for more on logins in automations, see logins.

  1. Go to the site I give you
  2. Check if it is showing a login page
  3. If it is, log in with my email and password
  4. Then carry on with the rest of the task
Click to launch the Chrome extension. Not installed? You can create an account and try it free.Opens the Chrome extension. Free account to try.

Have a look at the site's login page first: a word in its URL (such as login or sign-in) or a piece of text on it (such as a Login heading) is what the check matches. The agent asks for your login details; this example reads them from a Google Sheet with Read data from a Google Sheet.

The video shows the agent building the login check from the four lines above, in a few minutes.

Build the login check step by step


The steps the agent builds, as the Builder shows them: each step by its name, with the fields to set under it. Add them yourself in this order in the step-by-step builder, or open the agent's result there to adjust it.

  • 1.0 Go to page
    • URL: the site
  • 2.0 Get current bot URL
  • 3.0 If condition
    • Data to check: the URL from Get current bot URL
    • Condition to check: login
    • 3.1 Enter text
      • Select text field: the email or username field
      • Text: the column of your sheet that holds it
    • 3.2 Enter text
      • Select text field: the password field
      • Text: the column of your sheet that holds it
    • 3.3 Click element
      • Select: the site's login button

Common questions about the login check


Which login check should I use, the URL or the page text?

Use the URL check when the site has its own login page or subdomain, and the page text check when the login appears on the same URL, for example in a popup. For the page text check, put Get data from bot's current page inside a Try / Catch step, selecting the login text such as the page's Login title: on a page with no login the step finds nothing and errors, and the Catch branch catches the error so the run carries on. Under the scrape, the If condition checks [scrape-data] for Login instead of the URL.

Can I log in without keeping my password in a Google Sheet?

Yes. The Log in with credentials step fills the username and password fields from login credentials you save in axiom.ai. Put it inside the If condition in place of the two Enter text steps.

How do I stay logged in when the automation runs in the cloud?

Store the site's cookies so the cloud run uses your existing login session. See store cookies.

Why does the site show a CAPTCHA after the automation logs in?

Some sites show a CAPTCHA challenge on login activity. See the 2Captcha integration for running automations on sites with CAPTCHA turned on.

Why does the login check never find the login page?

The URL word or the text you match is not on the page. Open the login page and check the exact word, then update Condition to check. When a run fails, hand it to the agent and it repairs the step.

Can I check for a login without code?

Yes. The check is an If condition on the page's URL or text, with no script in it. Describe it and the agent finds how the site's login page differs from the rest.

Can I run the login check on a schedule?

Yes. Save the automation and set a schedule. Each run opens the site and logs in only on the runs where the site asks, so an expired session does not stop the task.

Where do I get help?

Get in touch with support, or ask in the axiom.ai community.

Related guides