The Web Script Builder

Top  Previous  Next

×V4.1Ø

S

A

W

WS

ü

The Web Script Builder

The Web Script Builder is a tool that is built into EMUE that allows you to click on an element on a web page and build a command for that element.  EMUE identifies the element and guides you through the process of creating a valid command.

 

Once a web page has been opened using the OpenWebPage command, it can be opened from the Tools menu.

 

WSBNew

 

Once you click the “Capture My Clicks” button, you can identify a web element simply by right-clicking on it.  Make sure that the button turns red before clicking on the web page.  If you left-click on an element, the web page will respond normally.  This may be clicking a button or following a link.  A right-click will identify the element but will not click through.

 

Hovering While EMUE is Capturing Clicks

Once the “Capture My Clicks” button has been clicked, EMUE begins to pay attention to what you are hovering over in the Web Browser.  You will notice that the button turns red and, the label to the left of the button will change to show you what type of element you are hovering over.  This is helpful for confirming that you have the element you think you want.  For example, if you are trying to identify a button, and the Web Script Builder shows that you are hovering over a table cell, it could be that the button is embedded in a table cell and you have not yet identified the element that you want.

 

You will also notice a box around the element that you are highlighting. A green box indicates that the element can be identified using something reliable like an ID or Name.  Generally this means that the identification will be successful.

 

 

A red box indicates that there is less information to identify the element.  This can be viewed as a warning and it may be better to identify the element in a different way.  This will be discussed in more detail later.

 

 

Locking an Element or Attribute

There are many cases where the type of element you are trying to identify is obvious.  Most of the time, you will know if the element you want is a button, a checkbox, or a textbox.  In such cases, it may be helpful to limit the Web Script Builder to only pay attention to elements of that type.  For example, if you are trying to click a button, and you want the Web Script Builder to ignore the table cell that the button sits in when you are hovering over it, you can select Button from the Element Type dropdown and then click on the lock.  The icon should switch to a closed lock, and now as you move around the webpage with your mouse, only buttons will be highlighted.

 

WSBLock

 

Locking a Group of Elements

In some instances, it may not be obvious what kind of element you are looking for.  For example, what looks like a button, might actually be a span or a div.  If you know you want to click on an element, but you aren't sure of the element you need, you can lock down a group of elements like clickable elements.  This will narrow the scope of what EMUE is looking for while still allowing EMUE to look for more than one element type.

 

The image below shows all clickable elements being selected.

 

WSBClicklable

 

Individual element types can also be selected.

 

WSBLockingElements

 

Similarly, if you do not know the type of the element, but you know that “State” will be part of the elements name, you could choose Name from the Attribute dropdown, type “*State*” in the Value text box (the asterisks are wildcards that tell the Web Script Builder to look for “State” anywhere in the name), and then lock the Attribute lock.  You will notice that the Attribute and Value locks are coupled.

 

 

WSBWildcard

Using an Element that you have Identified with the Web Script Builder

Once you have right-clicked on an element, the window will expand, giving you options for what you can do with this element.

 

WSB2

 

Choosing an Action:

Flash Element:  This button causes the element that you have identified to light up yellow on the web page.  Note that in some cases, the web page prevents this, but in many cases, it serves as a good indication that you identified the element that you were looking for.
Show Extracted Value:  This button opens a window showing the value of the element identified.  Typically this is the text associated with an element.  From this pop-up, the user has the option to continue and build a command that can be inserted into the EMUE script.
Build Command:  This button opens a window that guides you through the creation of a command.  You can choose to see only commands that extract values, only commands that take actions, or both.  The Command Builder will filter out all commands that are not appropriate for the element identified.  The Command Builder will also prompt the user for any other parameters that are required such as variable or list names.  The end result is a command that is ready to be pasted into an EMUE script.

 

CommandBuilder

 

Once all values have been set, the command can be added to the ScratchPad or copied to your clipboard so that you can paste it right into your script.  The ScratchPad is a place where commands are stored until you are ready to paste them into your script. Alternatively, you can test the command before adding it to your ScratchPad if you would like.  Remember, identifying the element successfully and executing a command are two separate tasks.  In order to be sure that you have built a command that will work, it is a good idea to test it even if you are confident that you identified the element successfully.

 

When you have the command in the ScratchPad or you have pasted it into the script, you may notice that the first section of the element identifier may be specific to your test or production system.  To remedy this, and so that you dont have to change the script when moving from test to production, you can simply remove the part of the identifier that is specific to one system and replace it with an asterisk wildcard (*).

 

The following line is a command that came out of the Web Script Builder:

 

ClickWebElement "Browser=*Soarian*:sframeInner->wellFrame:Button,ID=nextButton,INDEX=1"

Extracting Web Values:  How and Why?

Oftentimes, your web scripts will navigate through pages, make selections, click buttons, and complete tasks.  Equally as important as completing actions (clicks, selections, etc) on web pages is retrieving data from web pages.  You may need to confirm the results of a search, check for errors, or work through a data table.

Extracting Basic Values

Typically, extracting a single piece of text is the simplest form of data extraction.  However, if the text is embedded in HTML structures like tables, spans, or divs, it may be more complicated.  The easiest way to determine if you can get a handle on the element you want is to try with the Web Script Builder.

 

First, click the Capture My Clicks button in the Web Script Builder.  Then, identify the value that you would like to extract by clicking on it.  Take advantage of the hover-box that appears when you identify the element to be sure that you are on the element that you want.  Right-click to capture the element.  At this point, you can click the “Show Extracted Value” button on the Web Script Builder screen.  This will open a window and display the results.

 

Here is an example.  In this case, we are trying to extract the label that says “Search by.”

 

 

After clicking “Show Extracted Value,” we get a window that shows the value.  From here, if we do not like what was retrieved, we can click the “Cancel” button and try again, or if we do like what was returned, we can click “Build Command” and the Web Script Builder will help us build a command.

 

TestExtraction

 

Since we just tested an extraction for a label, the Web Script Builder will use that information to provide extraction commands that are valid for that type of element.

 

CommandBuilder

 

The Web Script Builder provides a list of existing variables that we can use for storing the result of our extraction, or we can type in a new variable name.  Once we have entered all information that is expected, we can add the command to our ScratchPad or copy it to the clipboard.

 

Anchoring an Element Using the Web Script Builder

There are also scenarios where an element just does not have a good identifier.  If this is the case, accessing the element based on its existence inside another element may help you build a more reliable command.  For example, if you can determine that the element appears inside of a Table, Span, or Div, you can identify that element first and then identify the element you actually want in relation to the container element (the Table, Span, or Div that contains your desired element).

Oftentimes, date fields in Soarian do not include any good identifying information.  Therefore, if there are multiple date fields on one page, it is difficult to identify the right one.  However, typically the date field is embedded in another element that can be identified reliably.  By anchoring the containing element, it becomes easy to identify the date element.

Using the Web Script Builder, building a command like this is easy.  The first step is the anchor the container element.  That is, first we must identify the containing element and have the Web Script Builder remember it.  To do this, identify the containing element normally by right-clicking on it.  Then instead of building a command, click the Anchor Element button.  You will see a description of the element appear in the white window below the buttons in the Web Script Builder.

WSBAnchor1

Now, if you identify another element, the Web Script Builder will identify its relative position to the anchor element you identified.

WSBAnchor2

Once an element is anchored, any actions you take to identify an element will reference the original anchor.  At this point, you can build your command normally.

CommandBuilderPaste

Working with Pop up menus in Soarian

Because of some structural design in Soarian Financials there have been specific areas where the web script builder has not been able to capture a web element. This was a problem when identifying menu options from the Actions button on the Receivable Group Details page in Soarian Financials and similar built menus throughout the application.

 

Once you identify the button simply choose ClickWebElement_Button_PopupMenu from the command drop down. The web script builder will present menu options and you can pick the item you want from the list.

 

Copy the command to the clipboard and paste in your script. EMUE will build the command to click the button to expose the menu options and the command to click the option.

 

ClickWebElement "Browser=*Soarian*:sframeInner->wellFrame->tabWell*:Button,id=ctlReceivableGroupActionsBtn,INDEX=1"

ClickWebElement "Browser=*Soarian*:sframeInner->wellFrame->tabWell*:Button,id=ctlReceivableGroupActionsBtn,INDEX=1->Position=TableCell,innertext=Demand statement,INDEX=1"

 

SoarianPopUp