Top tips for web automation in the chrome browser
There's nothing quite like the magic of seeing a bot automate Chrome and do your boring, repetitive tasks for you. Happily, anyone can automate the browser with Axiom.ai (opens new window)'s no-code tool – you really don't need to know how to code. Sure, sometimes you'll need to have the patience to learn a new skill, but these top tips will help you take your web automation skills from novice to pro status quickly.
This post includes methods for speeding up web scraping 🚀, web automation with key presses ⌨️, and appending data from separate steps in Axiom's builder.
# 1. How to select button clicks using text
When using the 'Click Element' step to automate button clicks, did you know that if a button has unique text (such as "Send Message"), you can select the button by its text instead of using a CSS selector? By using this option, Axiom will search for the string rather than a CSS selector to find the element on the page.
It's really simple:
- Click "Select" in your "Click Element" step
- Click on 'Custom'
- Tick the box labeled "Use element text instead of HTML”
- Enter the text inside the box and click "Complete”
This trick is often used when automating Instagram. For instance, an annoying pop-up that can only be closed with a 'Not Now' button appears during runtime when running an Instagram bot. Since it cannot be selected using the selector tool, the text method should be used instead. This method works perfectly and allows the pop-up that appears on Instagram to be removed every time.
# 2. How to prevent errors when buttons are not always present
In the 'Click element' step, there is a useful checkbox labeled 'Optional click' that you may have overlooked. Check this box if the button you are selecting is not always present. Normally, Axiom.ai (opens new window) will throw an error stopping your bot if a button is missing. This option is particularly useful if you are creating an automation that loops through pages in Chrome clicking buttons.
To use the Optional click open your click element step and tick the box.
# 3. How to keep Axiom running despite errors
Occasionally, when automating a browser, your bot may encounter an error that halts its run - for instance, an empty selector when scraping data. In such cases, you may want your bot to keep running, ignoring the error.
To achieve this, simply tick the ‘Continue on Error’ box. Here’s how to find it:
- Click on the menu icon with three dots located in the top right corner
- Click on "Settings"
- Click "Continue on error" in the sidebar and tick the box
# 4. How to speed up your web scraper in Chrome
We have worked really hard on our scraping tool, and we think it's pretty good. It has undergone many updates, so you may not have noticed the configuration options we recently added. These options can be used to optimize your scrapers and make them run even faster.
Warning: If you run the scraper too quickly, it may execute before the data is fully loaded. Some experimentation may be required to determine the optimal speed for the site you are using or your internet connection.
In the "Get data" step, look for the "Configuration" section and click to expand your options. These are the settings you will see:
- Wait time between scrolls (ms) - if scraping a content of a page (not a listing) reduce this down to 2000
- No. of retry attempts when results not found - if your page loads quickly and no additional content is loading try as low as 0
- Minimum wait before scraping (ms) - we often leave this unchanged, would recommend focusing on step 1-2
- Page number to start scraping on - N/A
- Force a re-scrape - Untick unless you get an issue with missing page data after the first page
Experiment and see what works best!
# 5. How to use the keyboard to unstick your automations
There are times when automating the browser using the ‘Click element’ or ‘Enter text’ step just does not work. That's when the Keypress step can prove to be very handy. This step lets you record keystrokes, which is useful because a tab can switch between inputs, a down arrow can scroll the page down, and a return can click a button. If you ever get stuck, give this step a try.
To use the "Press Key(s)" step, add the step, click "Record", and type the key(s).
# 6. How to get the last day of the previous month as a variable
Getting the last day of the month is a useful feature for automating report generation. Our date and time step includes a neat feature that allows you to do this in seconds. Here’s how to use it:
- Add new step in the builder and search for ‘Get and date time’
- Select "custom"
- Choose 'Last day of previous month' from the select list
- Choose your preferred format
A word to the wise: if you ever use the date or time to write file names, remember that a '/' is not permitted. Instead, use dashes '-'.
# 7. How to upload or download files in the cloud
Axiom features steps for uploading and downloading files via our desktop app. Recently, we added two new steps that allow you to upload or download files to your Google Drive, which is incredibly convenient. And yes, they work in the cloud!
To use the Google Drive steps, simply click the ‘+’ button, search for ‘Google Drive’, and add the step you wish to use.
# 8. How to tell Axiom to switch to a new window or pop up
This is a common issue that people get stuck with when creating an Axiom. If you automate a click that opens a new tab or pop-up, Axiom does not automatically switch to that new window. It is important to explicitly tell Axiom to switch to the new window (both tabs and pop-ups are considered new windows). If you do not do this, your Axiom will not work. Fortunately, we have a step to help you accomplish this task:
- Add a new step and search for “Switch browser tab”
- Set the tab selection to "Last opened" or specify a tab number (1 being the first tab in the browser)
This step is pretty easy to use; just leave it on the "newest tab" setting. However, remember that you may need to add another one of these steps to go back to the original window! We also have steps for closing a tab.
# 9. How to join two separate pieces of data in Axiom
If you are building an Axiom and you want to join the data output of different steps, you can use the handy Append step. This allows you to join data either vertically or horizontally.
To do this, simply:
- Add a new step in the builder and search for “Append”
- Select the sources for 'Data A' and 'Data B'
- Choose whether you want to append the data vertically or horizontally. ‘Horizontal’ adds the second set of data as new columns, while ‘vertical’ adds it as new rows.
You can chain multiple append steps together if you need to join more than one data source. To do this, choose the previous ‘Append’ step as the ‘Data A’ source and add your new data to ‘Data B’.
# 10. How to combine several Axioms into one
Axiom comes complete with a ‘Run Another Axiom’ step. This allows you to import Axioms into a single controller Axiom. This step is really useful for building complex Axioms with many steps. It can be handy to break complex Axioms down into several parts that you can run independently and maintain.
To use the ‘Run Another Axiom’ step simply:
- Add a new step in the builder and search for “Run”
- Inside the step, select the Axiom you want to load
During runtime, any external Axioms will be triggered in the order they appear.
# Conclusion
We hope you find these tips useful for developing your axioms and improving your browser automation skills. If you are interested in learning more, you can watch our videos (opens new window) or read our documentation (opens new window). Also keep an eye on our release notes to discover new features and updates (opens new window).
Please always feel free to reach out and ask support if you need it.
Keep an eye out for tips on structuring your Axioms, coming soon.