One notable change from UBot 3.5 to UBot 4.0 was the departure from the choose commands, with which you would use a distinct command to choose which element you wanted to work with, in favor of the new selectors, which allow you to get specific about which element or elements you want to play with directly from the action command itself. You’ve probably seen these, usually looking something like
<username field>
or
<name=user>
UBot Studio usually does all this stuff for you, so you never have to give it a second thought. But what many people don’t realize is that there is an entire mini language behind these selectors, and you can actually do some pretty amazing things with it.
The Basics
UBot Studio 4 comes prepackaged with a number of built in artificial intelligence selectors. Selectors like
<username field>
look through the html on the current page find elements that look like they’re probably for usernames. The current AI selectors are:
- <username field>
- <password field>
- <email field>
- <first name field>
- <last name field>
- <full name field>
- <company field>
- <address line1 field>
- <address line2 field>
- <city field>
- <state field>
- <state dropdown>
- <country field>
- <country dropdown>
- <zip code field>
- <phone field>
- <fax field>
- <sex male checkbox>
- <sex female checkbox>
- <sex dropdown>
- <birthday field>
- <birth month dropdown>
- <birth day dropdown>
- <birth year dropdown>
- <birth year field>
- <login button>
- <create account button>
- <terms of service checkbox>
- <url field>
- <headline field>
- <about me textarea>
Please note that these selectors are a computer’s best guess of an abstract concept, and will not work 100% of the time. Still, what these AI selectors allow you to do is create scripts without having to know the exact html for an element. It also means that you can write scripts that will work across multiple sites, even when the sites don’t have the same html.
The Less Basic
AI is an imperfect art, which means that sometimes you’ll have to interact with the html. The UBot Studio Selectors allow you to match elements based on their attributes.
<name="user">
will match any element with the name “user”.
<type="text">
will match all the text boxes on the page.
You can actually get kind of fancy with these too. Let’s say that you want to find all the elements in which the name contains the text “user”. Simply put
<name=c"user">
The ‘c’ in front of the quoted “user” tells it that we want anything containing the text. Likewise,
<name=w"user*">
turns the asterisk into a wildcard. In
<name=r"user[0-9].">
the ‘r’ allows you to use simple regular expressions in your text.
Besides the advanced matching of attributes you have access to, there are also special attributes that don’t exist in html, but do exist in the UBot selector language. These are the following:
- tagname – The name of the tag in question. For example: div, img, a, table, etc.
- before – The text that comes directly before an element. This is useful, for example, in identifying a textbox by its label.
- after – The text that comes after an element. This is useful for identifying radio boxes by their labels.
- fieldset – If a field is inside a fieldset, this will match the label in that fieldset.
- image – Used in conjunction with image recognition.
The Advanced Stuff
You can get pretty fancy with selectors by using boolean logic. For example, you can match more than one attribute with something like
<tagname="div" AND class="content">
If you wanted to match all the textboxes and password fields on the page, you might use something like
<tagname="input" AND (type="text OR type="password")>
Now, it might be the case that you want either the id or the name to contain either “user” or “login”. These can tend to get long very fast. Even at two attributes and two possible texts, the selector is already
<id=c"user" OR name=c"user" OR id=c"login" OR name=c"login">
Fortunately, there is a shorthand that covers these situations. The previous example is the same as using
<id,name=c"user","c"login">
This matches each attribute with each piece of text, and can save a lot of time.
As a final note, when you use spaces in selectors in anything other than an exact match, the space can represent any connecting character. So for example, c”login name” will also match “login.name”, “login-name” and “login_name”.
Putting it Together
So what do we get when we put it all together? Well, we come full circle, and we get the AI selectors! It turns out that the AI selectors are merely short hand for complicated selector language. For instance,
<username field>
is actually
<type=w"text" AND tagname=input AND (id,name,before=w"user",c"user name",c"user id",c"login name",c"login id")>
<password field>
is shorthand for <type=w"password" AND tagname=input AND (id,name,before=w"pass",c"pass word",c"pass phrase")>
And if you’re ready to be truly afraid
<address line1 field>
is really
<type=w"text" AND tagname=input AND ((id,name,before=w"address") OR (id,name,before=c"address" AND NOT id,name,before=c"line 2"))>
Selectors are one of those things that, for right now, let us do some pretty cool things, but I know that in the future, there are going to be some UBotter heroes that are going to test, experiment, and invent their way to fully unlocking the power of the UBot selectors.When that happens, the world of traditional internet marketing will be but a echo in the UBot marketer’s ear. Oh wait, that’s already true.