By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
RPABOTS.WORLD
  • Topics
    • UiPath
    • blue prism
    • Open Source RPA
    • power automate
    • automation anywhere
  • Resources
    • RPA News
    • UiPath Free Course
    • Software
    • Jobs
    • Publications
  • Contact-us
    • Write For Us
    • Editorial Team
Notification
  • My Interests
  • My Saves
  • My Feed
  • History
Personalize
RPABOTS.WORLDRPABOTS.WORLD
Aa
Search
  • Topics
    • UiPath
    • blue prism
    • Open Source RPA
    • power automate
    • automation anywhere
  • Resources
    • RPA News
    • UiPath Free Course
    • Software
    • Jobs
    • Publications
  • Contact-us
    • Write For Us
    • Editorial Team

Top Stories

Explore the latest updated news!
Robot Framework Python: Working with Databases

Robot Framework Python: Working with Databases

Continuous Integration and Deployment with Robot Framework

Continuous Integration and Deployment with Robot Framework Python

Top 5 Tips for Writing Clean and Maintainable Robot Framework Python Code

Top 5 Tips for Writing Clean and Maintainable Robot Framework Python Code

Stay Connected

Find us on socials
248.1k Followers Like
61.1k Followers Follow
165k Subscribers Subscribe
Made by ThemeRuby using the Foxiz theme. Powered by WordPress
RPABOTS.WORLD > Blog > Topics > Open Source RPA > How to Create Your Python RPA Bot Using Automagica Package
Open Source RPA

How to Create Your Python RPA Bot Using Automagica Package

Satish Prasad
Last updated: 2021/11/16 at 7:33 PM
By Satish Prasad 1 comment 1
Share
10 Min Read
Python RPA Bot Using Automagica
Image of computer monitors updating the software they standing on the table in dark room
SHARE

Most of the RPA platforms were built on the .Net framework taking advantage of its close integration with the Microsoft OS. However, given Python’s growing popularity, it is no surprise that new RPA platforms have also started using Python as the choice of language to build RPA frameworks.

Contents
Prerequisite to Build Python RPA Bot Using AutomagicaCreating Virtual Environment Install the Automagica Python library Various Supported Activities in Automagica Python PackageBuild your First Python RPA Bot Using AutomagicaProblem Statement- Working Example Automagica and DockerReferences

TagUI is the leading open-source RPA software 🤖 with thousands of active users, Another example is “RPA Framework” Now maintained by Robocorp providing RPA Framework as a collection of open-source libraries and tools for Robotic Process Automation (RPA).

Automagica is another fast-growing Python Based Open Source RPA library which provides an open-source (robotic) process automation platform. With Automagica, automating cross-platform processes becomes a breeze.

In the previous post, we have discussed “How Automagica can be configured” and Automagica Flow can be used to build RPA Bot.

In this post , We are taking different approach to build rpa bot using the Automagica package and python to perform the required task.

So this is pure pythonic approach to build robot for your work…

Lets get started !

Prerequisite to Build Python RPA Bot Using Automagica

Under the hood Automagica is Build using the popular python library and its provide full support to python.

for getting started you need –

  • Anaconda or Python With PiP (Should be 3.7 or Higher )
  • Editor of your choice such as Pycharm/VSCode/Spyder etc. to Write your Python code

Creating Virtual Environment

I will suggest creating Virtual Environment so that it’s separated with other projects library, Lets say Automagica (This is optional and you can use your existing env or system default env in case you don’t wish to create one)

You can read more about – Virtual Environment.

How to Create Your Python RPA Bot Using Automagica Package 1
Create Virtual Environment Using PyCharm

Install the Automagica Python library 

For installing the Automagica Python Library, All you need to make sure that you have Python 3.7 Installed. (As of now 3.7 is Supported) and then Automagica can be install using pip as below-

pip install automagica --upgrade

You can also pull the automgaica git repository and install an editable version of the package using below-

pip install virtualenv
git clone https://github.com/automagica/automagica
cd automagica
virtualenv create automagica
activate automagica
pip install -e .

Or Simply using the Command prompt from PyCharm IDE.

How to Create Your Python RPA Bot Using Automagica Package 2

Quick Note- When you install following dependencies will also be installed .

Installing collected packages: mimesis, Pillow, click, pycparser, cffi, six, cryptography, mss, pyasn1, pycryptodomex, ply, pysmi, pysnmp, numpy, pytz, python-dateutil, pandas, pyglet, babel, idna, pyOpenSSL, urllib3, selenium, pywin32-ctypes, zipp, importlib-metadata, keyring, pyzmq, Send2Trash, pyrsistent, attrs, jsonschema, ipython-genutils, traitlets, pywin32, jupyter-core, nbformat, tornado, pywinpty, terminado, prometheus-client, jupyter-client, entrypoints, webencodings, pyparsing, packaging, bleach, pandocfilters, pygments, async-generator, nest-asyncio, nbclient, mistune, defusedxml, MarkupSafe, jinja2, jupyterlab-pygments, testpath, nbconvert, argon2-cffi, decorator, parso, jedi, pickleshare, colorama, backcall, wcwidth, prompt-toolkit, ipython, ipykernel, notebook, psutil, jdcal, et-xmlfile, openpyxl, lxml, python-docx, keyboard, future, pyad, mouse, PyPDF2, automagica

Various Supported Activities in Automagica Python Package

  • Cryptography – Useful for creating Encrypted Text, Files, Generating Key Based password etc.
  • Random – Useful for creating all type of Random Data
  • Output – Interacting with Console to print a message
  • Browser – Automated Chrome Session to find elements using XPath or other properties.
  • Credential Management -Stores credentials locally and securely
  • FTP – Used to automate activities for File Transfer
  • Keyboard – Simulate keystrokes and Keyboard based actions.
  • Mouse – Displays mouse position and perform various activities using element ID (vision)
  • Image – Screen Capture
  • Folder Operations – File and Folder based activities.
  • Delay – For introducing delays
  • Word Application – Works with MS Doc. Microsoft Office Word needs to be installed on the system.
  • Word File – Works with MS Doc. Microsoft Office Word needs not to be installed on the system.
  • Outlook Application – Outlook application operations
  • Excel Application – Works with MS Excel Operations. Microsoft ExcelWord needs to be installed on the system.
  • Excel File – Works with MS Excel Operations. Microsoft ExcelWord needs not to be installed on the system
  • PowerPoint Application – For PowerPoint activity to work, PowerPoint needs to be installed on the system.
  • Office 365 – Send email Office Outlook 365
  • Salesforce – Activity to make calls to Salesforce REST API.
  • E-mail (SMTP) – Email Using SMTP
  • Windows OS – Various activities for Windows Operating System.
  • Terminal – Runs a command over SSH (Secure Shell)
  • SNMP – Retrieves data from an SNMP agent
  • Active Directory – Interface to Windows Active Directory
  • Utilities – Various activities for the user-based profile.
  • System – Low-Level Activities to manage File Operation
  • PDF – Extracts the text from a PDF, Merge PDF
  • System Monitoring – Runtime Resources information such as CPU
  • Image Processing – Various option to perform image activities such as rotate, crop etc.
  • Process – Process Management
  • Optical Character Recognition (OCR) – Reading Text Using OCR
  • Alternative Frameworks – To invoke other Frameworks Execution like UiPath, AutoIt, Robot Framework, Blue Prism, Automation Anywhere
  • General – Exception Handling
  • SAP GUI – Interaction with SAP Systems
  • Portal – Interaction with Automagica Portal
  • Vision – This activity can be used to check if a certain element is visible on the screen.Note that this uses Automagica Portal and uses some advanced fuzzy matching algorithms for finding identical elements.

Under the hood, Automagica is built on some of the greatest open-source libraries provided by the other community developers such as requests, selenium etc…

Build your First Python RPA Bot Using Automagica

Problem Statement- 

We are going to create a WebScarpper Bot, Which reads the outlook to get the email attachment for Input Search Term, Search it on Wikipedia and Send Scrapped Data on Pre-Configured email.

In this example following operations will be performed–

  • Read Email from Outlook Using Outlook Activities & Save Input Attachment Excel
  • Read Input File Using Excel Activities
  • Loop Over the Content of Files to get Search Terms
  • Open Wikipedia and Search for Given “Search term in Loop”
  • Web Scrape Wikipedia Page and Send Result as Email to Configured Email
  • Finally, Close all the open application

If you wish to use Automagica Flow to build automation using Visual IDE , Check details here.

Working Example

from automagica import *

SAVE_FOLDER = "Data"
WIKI_URL = 'https://www.wikipedia.org'
RESULT_MAIL = "rpabotsworld@gmail.com"


# Open Outlook to Read Emails
outlook = Outlook()
emails = outlook.get_mails(folder_name="Inbox", fields=None)
Files = outlook.save_attachments(output_path=desktop_path())

# Excel Files
excel = Excel(file_path=desktop_path()+'\Input.xlsx')
data = excel.read_worksheet(headers=True)
excel.quit()

for row in data:
    browser = Chrome()
    browser.get(url=WIKI_URL)
    print("Going to Search for :- " + row['TEXT'])
    # Find the search bar using the Xpath
    search_bar = browser.find_element_by_xpath('//*[@id="searchInput"]')
    #search_bar = browser.find_xpath('//*[@id="searchInput"]')
    search_bar.send_keys(row['TEXT'])
    # Submit the query
    search_bar.submit()
    wait(seconds=2)
    # Find the element that holds the text
    text_element = browser.find_element_by_xpath('//*[@id="mw-content-text"]')
    # Extract the text from the element
    wiki_text = text_element.text
    # Send Email
    outlook.send_mail(to_address=RESULT_MAIL,subject="Wiki Extracted Text", body=wiki_text)
    # Quit the browser
    browser.quit()

# Close Outlook
outlook.quit()

Congratulation! You have created your first robot using the automagica Python Library, But it’s not done unless we deploy it on Automagica portal for running in unattended mode or scheduled run.

You can lean more about publishing your Bot Automagica Portal Dashboard to schedule or create Jobs on Automagica Portal to run as per your need.

Follow Details here – Deploy Robot on Automagica Portal

Automagica and Docker

As Automagica is fully cross-platform and built with Python, it’s actually quite straightforward to build and run Automagica bots from within containerized environments.

git clone https://automagi.ca/github
cd automagica
docker build . -t automagica
docker run -it -p 8080:8080 automagica

Then browse to http://localhost:8080/vnc.html to access the Automagica desktop.

To get started building your automation, you can run in the command line. Check out command-line documentation for all the automagica commands.

References

  1. https://github.com/automagica/automagica
  2. https://automagica.readthedocs.io/

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.

By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter LinkedIn Reddit Telegram Email Copy Link Print
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
By Satish Prasad
Follow:
Satish Prasad Holds a Master Degree(MCA) from NIT Kurukshetra. He has 8+ years of experience in Data analytics, Dataware house, ETL, Production support & Robotics Process Automation. In his assignments with multiple IT Firms, for the last 7+ years, he has contributed to various function in Investment Banking & Mutual Fund domain.
Previous Article Rethinking RPA Impact: Can RPA Create More Jobs? 3 Rethinking RPA Impact: Can RPA Create More Jobs?
Next Article UiPath PowerShell Integration Step by Step Guide Step by Step Guide | PowerShell UiPath Integration
1 Comment 1 Comment
  • Dee says:
    10/14/2022 at 3:22 pm

    I can’t see a date on this post but am guessing it’s seriously old and outdated because it says “For installing the Automagica Python Library, All you need to make sure that you have Python 3.7 Installed.” I’m on 3.10 which was out about a year ago.
    It would REALLY help if you put a date on technical posts because without it there’s no way of judging whether it’s outdated or not even if it was posted just last week.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Want to learn more? 🚀

Robot Framework Python: Working with Databases
Robot Framework Python: Working with Databases
RPA
Ensuring
Ensuring RPA Security: Best Practices and Guidelines
RPA
Robotics Process Automation in Finance and Accounting
RPA Upscaling All Dynamics of the Healthcare Industry in 2023
RPA
Low-Code/No-Code Development Platforms: The Future of Software Development? 5
Low-Code/No-Code Development Platforms: The Future of Software Development?
RPA

💙 Subscribe to me on YouTube :)

👉 Stay Connected

Instagram Follow
Youtube Subscribe
Telegram Follow

Related Stories

Uncover the stories that related to the post!
Work Data Management break up a process into separate work items
Open Source RPA

Working Example Using Robocorp Work Items | Definitive Guide

create your first automation in OpenBots Studio
rpa challengeOpen Source RPArpa use cases

OpenBots Working Example | Solve RPA Challenge Open Source RPA Tool

Open Source RPA Tool Robocorp | Beginners Guide 7
rpa toolsOpen Source RPA

Open Source RPA Tool Robocorp | Beginners Guide

RPABOTS.WORLDRPABOTS.WORLD
Follow US
Disclosure: Posts on this site may contain affiliate links, meaning that if you click on one of the links and purchase an item, we may receive a commission (at no additional cost to you). All opinions are our own and we do not accept payments for positive reviews. All product names, logos, and brands are the property of their respective owners in the United States and/or other countries. All company, product and service names used on this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.
Copyright © 2019 - 2023, RPABOTS.WORLD., unless otherwise noted. All rights reserved.
Join Us!

Subscribe to our newsletter and never miss our latest news, podcasts etc.

Zero spam, Unsubscribe at any time. Copyright © 2019 - 2023, RPABOTS.WORLD., unless otherwise noted. All rights reserved.
Welcome Back!

Sign in to your account

Lost your password?