What are the advantages of Web Recorder over Screen Recorder for web page automation?
The screen recorder in AA does literally what it says. In real-time, the user uses their mouse and keyboard to move about the screen to do what they need to do.
So, let’s take an example
I have shares in Alphabet Inc. [GOOG:US] and I want to keep an eye on the price and save it into a file so I can review it later.
I’m now going to try and get the information I need from the Bloomberg website using the screen recorder functionality.
The code for attempt one is saved here.
As seen (if you open the code), the screen recorder code can be seen to be long winded slow and in fact it FAILS on line 2 if we try to re-run it as it is unable to find the ‘Start’ button which we performed a right click on initially to Open the web screen.
Ok - so this time we will do it again, but this time we will ensure that the Bloomberg IE window is open.
So now we have repeated our screen capture and are now trying to get the price for GOOG:US again and save it to notepad. The code for attempt two is saved here.
Because we didn’t MAXIMIZE the INTERNET Explorer window, when we try to re-run the task it fails because the IE window which it opened was not EXACTLY the same size and position as when the recording was made. Indeed, you can see in the screen shot taken during the re-running of the task, another website seems to have been opened by accident which must have been a link on the original page.
This graphically highlights the inherent weakness of screen recorder sessions. All mouse clicks / keyboard entries are performed at absolute co-ordinates, based on the screen position and resolution of the original machine upon which the screen recording was made.
So, unless one ensures that the application is in exactly the right place on the screen as it was when the recording was originally made it WILL fail. Not only is it prone to fail in the original machine upon which the recording was made but should the code be ported to run on another machine the chances of the resolution being the same are slim.
Now the web recorder is an entirely different beast.
It uses the underlying field names for all its reference, capturing its data using object cloning. So, it doesn’t matter what machine we use or how big the screen is set, web-recorder by using object names, will always find what you require. Furthermore, you can use it to extract data from websites which spans multiple pages by simply detecting the ‘next-page’ web control and then extracting the data on the next-page as needed. It’s strictly browser based and supports Microsoft Internet Explorer 100%.
The code, seen here, generated when using the web-recorder is far shorter which obviously makes it far easier to understand and maintain.
And the webrecorder also contains built in functionality to extract the data to a csv file which makes it easy to see and manipulate in excel or even load to a database using BCP or SQL*LOADER if one required.
So, to summarise if you need to interact with a web-page always choose the web-recorder as its
• Portable – can be used on any machine which has Internet Explorer installed
• Creates a small number of code lines which are easy to read
• It can navigate web controls and is able to extract data over multiple pages
• Can extract data from web tables
• Has built in features to save data direct to csv file