Web Automation Finally has Its Own Package!
Actually,
I’m a little late to the party because the Web Automation Family had moved into their new apartment months back.
You Mean To Say We Couldn’t Automate Websites Earlier?
No, no, we could automate websites alright, we just didn’t have a set of Actions specifically built for Web Automation.
Earlier, we had to rely on either the Universal Recorder, Capture Action and maybe some of the scripting packages to interact with web elements.
Isn’t There a Web Browser Action Package for That?
Yes there is, however the Actions allow us to interact with the Web Browser, and not the Web Elements.
You can open or close a window or tab, download files if you have the links handy and run JavaScript in that particular session – just to name a few.
Put simply, the Browser Action Package enables us to browse.
So is This Package a Replacement for the Capture Action?
The Capture Action is not going anywhere.
Its a priceless feature which can be used on both Web as well as Desktop Applications.
Nothing will replace it, in fact no one is getting their filthy developin’ paws anywhere near my Capture Action.
The Package was introduced to provide us with another option to automate websites – one that you might be familiar with.
But Wasn’t the Capture Action Enough?
I need to stop interrogating myself like this.
People will think I am crazy.
To answer your(my) question, Yes.
The Capture Action itself was more than sufficient, provided you have a doctorate in XPathology like I do.
However, the Web Automation Package offers more flexibility, which is why I recommend exploring it.
If you have worked with Selenium, then you will fall in love with this package, as it operates on the same set of principles which also means that you can now perform Automation Testing with Automation Anywhere!
Don’t worry though, even if this is your first time, learning how to work with the Web Automation Package will supercharge your web automation journey.
You’ve Sparked My Interest, Tell Me More
The package isn’t present in the Control Room by default.
You have to download it from the Bot Store and import it to your Community Edition if you want to use it.
In addition to the Web Automation Package, you also have to download a Driver for the web browser you want to perform web automation with.
As of today, you can only use Google Chrome or Microsoft Edge.
I downloaded the driver for Google Chrome since I am a Chrome-addict.
Also make sure the versions match, or else the bot won’t be able to establish a session between the web browser and driver.
Now lets head over to the Control Room and create a New Bot under Automation.
But before that,
Its Time for a Short Story
Think you are too old for storytime?
Alright Mr.ImTooOldForThis, click here to skip ahead.
Before joining RPA, I was continuously being shuttled across departments.
As much as I’d love to point my fingers at the management, the only person to blame was the person staring back at me in the mirror.
I didn’t have a clue as to what it is I wanted to do in IT, or whether I wanted to even be there in the first place. I had to make it look like I “knew” what I wanted or else they wouldn’t have authorized the transfer.
But really, why did I venture into outer space in the first place?
Well, I was initially put into presales and hated every second of it. That was not the galaxy I wanted to be a part of.
I requested for a transfer, and while I was in the process of “finding myself”, I was temporarily orbiting the QA team because even the HR didn’t know what to do with me.
Actually that isn’t the full story, but the point is I wasn’t in the right state of mind.
So I did the most adult thing imaginable, which was to bottle up my frustration and pretend like everything was ok.
Also, I had to accept that you don’t always get what you want, especially when you don’t even know what you want.
But things were a little different in QA, unlike the other departments I had the misfortune of orbiting.
It was in the QA team where I was first exposed to Automation Testing, and experienced a spark of interest.
I don’t know what came over me, but I slowly became obsessed with learning Java, creating Xpaths, TestNG and tried to tie everything thing into selenium even before the training started.
I’m inclined to believe that the energy I had bottled up inside transformed into an obsessive drive that powers me to this day – whether it be answering questions on the forum or blogging like my life depended on it(it doesn’t).
All in all, my experience in the QA Team was great.
They planted a seed of inspiration and were generous enough to train this vagabond for a period of 2-3 weeks before I was welcomed into the promised land of RPA.
I don’t remember much of the Java I had learned back then, but the Xpath logic I had cemented during that interval continues to provide massive returns.
If there is a lesson to this silly story of mine, then it would be that you don’t necessarily have to search for another galaxy to reside in, but search for the strength to endure whatever galaxy the universe puts you into, whether it be through prayer or through grit.
If you really don’t like it, then by all means, go ahead and leap into the unknown and prepare yourself for the interstellar nightmare you are about to experience.
Comparing Selenium with the Web Automation Package
Lets have a look at the Actions present under the Web Automation Package.
If you have worked with Selenium before, then you know the first step would be to initialize the driver before launching it and performing operations within the browser.
In Automation Anywhere, you have to begin every Web Automation with a Start Session Action.
If you were to do this in Selenium, you’d be looking at multiple lines of codes, while also having to keep an eye out for the dependencies.
public static void main(String[] args)
{
//Declaring variables
String chromeDrivePath = "C:\\Users\AA\Desktop\chromedriver.exe"
System.setProperty("webdriver.chrome.driver",chromeDriverPath);
//Initializing session
WebDriver driver = new ChromeDriver();
}
All of what you are seeing up there was performed in a single step with Automation Anywhere, which is why RPA is where it is today.
Also if you have noticed, I have highlighted the Function Library Field in Blue. We won’t explore it today, but I want you to be aware of it.
Next, lets navigate to About Me page at TheCodingTheory.
For that, you will have to drag in the Web Automation: Open Page Action.
This is what it would look like in Selenium:
public static void main(String[] args)
{
//Declaring variables
String chromeDrivePath = "C:\\Users\AA\Desktop\chromedriver.exe"
String baseUrl = "https://thecodingtheory.com/about-me/";
System.setProperty("webdriver.chrome.driver",chromeDriverPath);
//Initializing session
WebDriver driver = new ChromeDriver();
//Launches browser and navigates to TheCodingTheory
driver.get(baseUrl);
}
If you want to learn some Selenium, then head over to Naveen Automation Labs.
He puts up quality content on a regular basis.
Me being a content creator myself, know how difficult it is to keep creating content, which is why I always give shout outs to other content creators.
Now lets head over to the Education Series Page.
Ok, But How?
Like always, we have to create a path for the bot to identify the text.
Since this package is based off JavaScript, you have to pass in a JavaScript Path.
You can also use Xpaths, but to use Xpaths you have to pass in a Function into the Function Library Field in the Web Automation: Start Session Action. We will explore that next week.
That being said, you can still pass in absolute Xpaths if you aren’t comfortable working with JS.
To generate the JS Path, simply right-click -> inspect ->Copy -> Copy JS path
Paste that Path into the Web Automation: Click Action.
This package is being continuously updated owing to its popularity, so make sure you check out the Bot Store from time to time.
Next, lets try taking a screenshot of the Web Automation Poster I made for my Web Automation Series.
I’ve also included a Web Automation: Wait Element Action and a Delay to make sure that the element I am about to Capture loads entirely before the bot interacts with it.
And finally, we End our Session to terminate the Automation.
That was a very short introduction to the Web Automation Package.
There is a lot to dig into here, and I will think of some proper exercises and write something up for you.
This is really a good info about the web automation package. Quite interesting and thank you for bringing your story in storytime which is inspiring
Hi Rakshana,
Appreciate the feedback, don’t hesitate to offer suggestions for improvement, or if there are any topics you’d like me to cover.
Kind Regards,
TCT
Thank you for the wonderful explanation as always.Appreciate the effort you put in for people like us.