Plugin RoboB

From VoxCommando
Jump to: navigation, search

In some cases we must apply a registry "fix" to tell Windows to use the latest version of Internet Explorer in our RoboBrowsers. For more information see: Use latest version of Internet Explorer in RoboBrowser.

Go to the main Plugins page.

Go to the complete Plugin List.


Plugin Description

RoboBrowser (RoboB for short) allows you to automate a web browser contained within a VoxCommando window. A new RoboBrowser is created using the "Select" Action.

The window can be hidden. There are several ways to manipulate the browser to load, edit, and interact with web pages. You can "click" on items based on position and sometimes by ID etc. To really use this plugin to create new uses, it will help if you know a bit about html / css / javascript etc.

The embedded web-browser is running Internet Explorer.

Actions for the RoboB plugin

Click

RoboB.Click
Clicks the "Current Element".

Dispose

RoboB.Dispose
Close and destroy the current RoboBrowser.
After this command there will be no Current RoboBrowser, so you must select a new one before performing other actions.

Hide

RoboB.Hide
Hide the currently selected RoboBrowser.
The RoboBrowser window will still exist and can be interacted with.

ElementByID

RoboB.ElementByID
Searches the HTML document for an element by using its ID. If a match is found then this element will be set as the "Current Element".
If <Childnum> is specified, the "Current Element" will be set to the child with index <Childnum>.

  • Parameters: 1-2
  1. ID : Find the element with this ID [string]
  2. Childnum : Select the nth child of the element found [integer]

ElementByXY

RoboB.ElementByXY
Searches the HTML document for an element by using its X and Y coordinates. If a match is found then this element will be set as the "Current Element".

Note: X,Y coordinates can be found by first showing the window using RoboB.Show, and then selecting the "tracking" checkbox at top of the RoboBrowser window. As you move the mouse over the window, the x,y coordinates will be updated and other information about the element under the mouse will be displayed.

  • Parameters: 2
  1. X : [integer]
  2. Y : [integer]

ElementByName

RoboB.ElementByName
Finds the first element with name <Name>
The element found will become the "Current Element".

WARNING:
This action may be a bit slow when searching through large documents.

  • Parameters: 1
  1. Name : Tag type to find (e.g. DIV) [string]

ElementByTag

RoboB.ElementByTag

Scans all the elements with tags that match <Tag> and selects the <Index>th occurence.
The element found will become the "Current Element".
The first occurence will have an Index of 0.

Example: To find the 3rd

in a document, set:
<Tag> = div
<Index> = 2
  • Parameters: 2
  1. Tag : Tag type to find (e.g. DIV) [string]
  2. Index : zero based index [integer]

ElementParent

RoboB.ElementParent

Sets the "Current Element" to the parent of the "Current Element", if it exists. In other words "climb the html tag tree".
Example HTML:
<body>

BOO!


</body>



If the "Current Element" is the div with class "layout",
then its parent will be the div with ID "wrapper".
Executing this action twice would set the "Current Element" to the body.

ElementRegex

RoboB.ElementRegex
A tricky but powerful action. <Tag> is any html tag. A collection of all tags of this type will created and each one will be scanned for the regEx <Pattern>. The first element to match the pattern will become the new "Current Element".

Drill means that we start from the previously defined "Current Element" (i.e., defined in a previous action) and only search for tags that are children of it. If Drill is false then the entire html document will be searched for tags.

Note: All boolean params are optional and will default to FALSE.

  • Parameters: 2-5
  1. Tag : HTML tag. Example: div [string]
  2. Pattern : RegEx pattern to match [string]
  3. Drill : True = search from current element instead of root document [boolean]
  4. IgnoreCase : True = case insensitive search [boolean]
  5. SingleLine : True = match across lines [boolean]

Focus

RoboB.Focus
Give focus to the "Current Element".
For example, this could be used to put the cursor into a text field on the web page.

Fullscreen

RoboB.Fullscreen
Enables or disables the RoboBrowser fullscreen mode

  • Parameters: 1
  1. FullScreen : True=Fullscreen False=Normal [boolean]

GetHTML

RoboB.GetHTML
Returns all the HTML text for the "Current Element".

GetRoboList

RoboB.GetRoboList
Returns a list of all active RoboBrowser names with one name per line.

If <AsMatches> is true then the names will be returned as matches instead of in {LastResult}.

  • Parameters: 0-1
  1. AsMatches : Default: False [boolean]

GetText

RoboB.GetText
Returns all the text (not HTML) for the "Current Element".

GetURL

RoboB.GetURL
Returns the current URL for the currently selected RoboBrowser window.
To get the current URL for another RoboBrowser, first use the RoboB.Select action.

Navigate

RoboB.Navigate
Loads a web page into the current RoboBrowser using the specified URL.
This action will not wait for the page to load before allowing VoxCommando to move on to the next action. Placing a RoboB.Wait action after this action will pause the macro until the page has loaded. This freezes VoxCommando while it is waiting for the page to load. As an alternative, use the event as described below.

When the page is finished loading, an event with the format RoboB.DocComplete.Name will be generated (where <Name> is the name of the RoboBrowser that was defined when it was created using RoboB.Select).

  • Parameters: 1
  1. URL : web address to open in browser [string]

Select/New

RoboB.Select
Selects a RoboBrowser by name if it exists, otherwise it creates a new one.
The new RoboBrowser will be hidden. (see RoboB.Show)

  • Parameters: 1
  1. Name : Name of RoboBrowser to select [string]

SetHTML

RoboB.SetHTML
Sets the Outer HTML of the "Current Element" to the text specified. Outer HTML includes the opening and closing tags of the element along with all HTML contained within them (including child tags).

You can use this to put text into a text field for example.

This means we are changing the content of the webpage! This is powerful but can cause the page to misbehave.

You could, for example, use this to remove advertisements from a page, or to change the text that the page is displaying.

  • Parameters: 1
  1. HTML : new outer HTML to apply to element [string]

SetText

RoboB.SetText
Sets the text within the "Current Element". This could be used, for example, to set the text of an input field.

  • Parameters: 1
  1. Text : [string]

SetWinSize

RoboB.SetWinSize
Sets the dimensions of the current RoboBrowser Window.

Takes either 2 or 4 parameters.

The RoboBrowser Window must already be visible in order for this action to work, and if the window frame will be hidden this should be done before positioning the window.

Note that changing the window size can affect the X and Y coordinates of elements on the web page. Keep this in mind if using RoboB.ElementByXY.

  • Parameters: 2-4
  1. Width : Set the width of the browser window [integer]
  2. Height : Set the height of the browser window [integer]
  3. Left : Position the left edge of the browser window [integer]
  4. Top : Position the top edge of the browser window [integer]

ScrollRelative

RoboB.ScrollRelative
Scroll the webpage document by <relativeX>,<relativeY> pixels, relativel to the current scroll position of the document.

  • Parameters: 2
  1. RelativeX : scroll to the right by (pixels) [integer]
  2. RelativeY : scroll down by (pixels) [integer]

ScrollTo

RoboB.ScrollTo
Scroll the webpage document to position <X>,<Y> measured in pixels.

  • Parameters: 2
  1. X : Set left position (pixels) [integer]
  2. Y : Set top position (pixels) [integer]

Show

RoboB.Show
Shows the currently selected RoboBrowser.
Activates the RoboBrowser window and attempts to bring it "to the top".
Note: new RoboBrowsers are hidden by default when created.
Optional param <HideTools> is set to true will hide the panel at the top of the window.

  • Parameters: 0-1
  1. HideTools : Default=False [boolean]

ShowFrame

RoboB.ShowFrame
Show or hide the RoboBrowser's window frame.

  • Parameters: 1
  1. ShowFrame : True=show / False = hide [boolean]

Submit

RoboB.Submit
Submits the "Current Element". This is similar to clicking a submit button on a form.

Wait

RoboB.Wait
Pauses execution of the macro until the current RoboBrowser has finished loading the web page.