net.sf.sahi.client
Class BrowserElements

java.lang.Object
  extended by net.sf.sahi.client.BrowserElements
Direct Known Subclasses:
Browser

public abstract class BrowserElements
extends java.lang.Object

BrowserElements represents the different Accessor APIs that Sahi exposes.
Each of the APIs returns an ElementStub which is a representation of a particular HTML DOM element on the browser.
Have a look at Sahi Browser Accessor APIS for more information on each accessor. Note that regular expressions based accessors are different from Sahi's native accessors in that they are quoted as Strings:

Example:
_link(/visible .*ext/) in Sahi Script is equivalent to
browser.link("/visible .*ext/")

Some examples using various identifiers:

TypeExample
Pure indexbrowser.link(5)
idbrowser.textbox("searchbox")
textbrowser.cell("Ram")
valuebrowser.button("Click me")
applies for button and submit only
className (css)browser.cell("delete rounded-corner")
Regular Expression.
(Can be used for any accessor type)
browser.button("/Click/")
browser.cell("/delete .*corner/")
Index combination.
(Can be used for any accessor type)
browser.link("delete[1]")
browser.cell("/delete .*corner/[3]")

Some examples using DOM and Positional relations:
Simplebrowser.button("id")
Using nearbrowser.textbox("q").near(browser.cell("Ram"))
Using near and underbrowser.checkbox(0).near(browser.cell("Ram")).under(browser.cell("Delete user"))
Using inbrowser.link("delete").in(browser.table("summary"))

Thanks to Srijayanth Sridhar for converting the Sahi Script documentation to Javadocs.


Constructor Summary
BrowserElements()
           
 
Method Summary
 ElementStub abbr(java.lang.Object... args)
          Defines an abbreviation.
 ElementStub accessor(java.lang.Object... args)
          Defines a generic accessor.
 ElementStub activeElement(java.lang.Object... args)
          Defines the element in focus.
 ElementStub area(java.lang.Object... args)
          Defines an area element.
 ElementStub blockquote(java.lang.Object... args)
          Defines block quote.
 ElementStub bold(java.lang.Object... args)
          Defines bold.
 ElementStub button(java.lang.Object... args)
          Defines a button element.
 ElementStub byClassName(java.lang.Object... args)
          Defines an element accessed by class name.
 ElementStub byId(java.lang.Object... args)
          Defines an element accessed by id.
 ElementStub bySeleniumLocator(java.lang.Object... args)
          Defines a bySeleniumLocator.
 ElementStub byText(java.lang.Object... args)
          Identifies an element by text.
 ElementStub byXPath(java.lang.Object... args)
          Defines an element accessed by xpath.
 ElementStub cell(java.lang.Object... args)
          Defines a cell.
 ElementStub checkbox(java.lang.Object... args)
          Defines a checkbox.
 ElementStub code(java.lang.Object... args)
          Defines code.
 ElementStub cookie(java.lang.Object... args)
          Defines a browser cookie.
 ElementStub datebox(java.lang.Object... args)
          Defines a datebox.
 ElementStub datetimebox(java.lang.Object... args)
          Defines a datetimebox.
 ElementStub datetimelocalbox(java.lang.Object... args)
          Defines a datetimelocalbox.
 ElementStub dDesc(java.lang.Object... args)
          Defines a description of item in a definition list.
 ElementStub div(java.lang.Object... args)
          Defines a div element.
 ElementStub dList(java.lang.Object... args)
          Defines a definition list.
 ElementStub dTerm(java.lang.Object... args)
          Defines an item in a definition list.
 ElementStub emailbox(java.lang.Object... args)
          Defines a emailbox.
 ElementStub emphasis(java.lang.Object... args)
          Defines emphasis.
 ElementStub file(java.lang.Object... args)
          Defines a file element
Usage: browser.file(identifier)
HTML: <input type="file" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.file("uploadme")
Use with setFile.
 ElementStub heading1(java.lang.Object... args)
          Defines an h1 element.
 ElementStub heading2(java.lang.Object... args)
          Defines an h2 element.
 ElementStub heading3(java.lang.Object... args)
          Defines an h3 element.
 ElementStub heading4(java.lang.Object... args)
          Defines an h4 element.
 ElementStub heading5(java.lang.Object... args)
          Defines an h5 element.
 ElementStub heading6(java.lang.Object... args)
          Defines an h6 element.
 ElementStub hidden(java.lang.Object... args)
          Defines an HTML input element of type hidden.
 ElementStub iframe(java.lang.Object... args)
          Defines an iframe.
 ElementStub image(java.lang.Object... args)
          Defines a image.
 ElementStub imageSubmitButton(java.lang.Object... args)
          Defines a image submit button.
 ElementStub italic(java.lang.Object... args)
          Defines italic.
 ElementStub label(java.lang.Object... args)
          Defines a label.
 ElementStub link(java.lang.Object... args)
          Defines a link.
 ElementStub list(java.lang.Object... args)
          Defines a list.
 ElementStub listItem(java.lang.Object... args)
          Defines a listItem.
 ElementStub map(java.lang.Object... args)
          Defines a map.
 ElementStub monthbox(java.lang.Object... args)
          Defines a monthbox.
 ElementStub numberbox(java.lang.Object... args)
          Defines a numberbox.
 ElementStub option(java.lang.Object... args)
          Defines an option element.
 ElementStub paragraph(java.lang.Object... args)
          Defines a paragraph element.
 ElementStub parentCell(java.lang.Object... args)
          Defines a parent cell.
 ElementStub parentNode(java.lang.Object... args)
          Defines a parent node.
 ElementStub parentRow(java.lang.Object... args)
          Defines a parent row.
 ElementStub parentTable(java.lang.Object... args)
          Defines a parent table.
 ElementStub password(java.lang.Object... args)
          Defines a password field.
 ElementStub position(java.lang.Object... args)
          Returns position of an element.
 ElementStub preformatted(java.lang.Object... args)
          Defines preformatted.
 ElementStub radio(java.lang.Object... args)
          Defines a radio button.
 ElementStub rangebox(java.lang.Object... args)
          Defines a rangebox.
 ElementStub reset(java.lang.Object... args)
          Defines a form's reset button.
 ElementStub row(java.lang.Object... args)
          Defines a row(tr) within a table element.
 ElementStub rte(java.lang.Object... args)
          Defines rte.
 ElementStub searchbox(java.lang.Object... args)
          Defines a searchbox.
 ElementStub select(java.lang.Object... args)
          Defines a select on a drop down.
 ElementStub span(java.lang.Object... args)
          Defines a span element.
 ElementStub spandiv(java.lang.Object... args)
          Deprecated. 
 ElementStub strong(java.lang.Object... args)
          Defines strong.
 ElementStub submit(java.lang.Object... args)
          Defines a submit button.
 ElementStub table(java.lang.Object... args)
          Defines a table.
 ElementStub tableHeader(java.lang.Object... args)
          Defines a table header.
 ElementStub telbox(java.lang.Object... args)
          Defines a telbox.
 ElementStub textarea(java.lang.Object... args)
          Defines a textarea.
 ElementStub textbox(java.lang.Object... args)
          Defines a textbox.
 ElementStub timebox(java.lang.Object... args)
          Defines a timebox.
 ElementStub urlbox(java.lang.Object... args)
          Defines a urlbox.
 ElementStub weekbox(java.lang.Object... args)
          Defines a weekbox.
 ElementStub xy(java.lang.Object... args)
          Defines xy.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrowserElements

public BrowserElements()
Method Detail

accessor

public ElementStub accessor(java.lang.Object... args)
Defines a generic accessor.
A javascript eval will be performed on the parameter passed.
Use this to execute custom javascript accessors when no other Sahi accessors can be used.

Example:
browser.accessor("document.form1.textelement1").setValue("abcd");

Parameters:
args -
Returns:
a stub representing the accessor

button

public ElementStub button(java.lang.Object... args)
Defines a button element.
Usage: browser.button(identifier)
HTML: <input type="button" name="name" id="id" value="value">
HTML: <button type="button" name="name" id="id">value</button>
Identifier: index, value, name, id
Example:
browser.button("Sign in").click()

Parameters:
Identifier: - can be index, value, name, id
Returns:
a stub representing the element

checkbox

public ElementStub checkbox(java.lang.Object... args)
Defines a checkbox.
Usage: browser.checkbox(identifier)
HTML: <input type="checkbox" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.checkbox("Remember Me?").check()

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

image

public ElementStub image(java.lang.Object... args)
Defines a image.
Usage: browser.image(identifier)
HTML: <img src="/path/to/images/add.gif" id="id" alt="alt" title="title">
Identifier: index, title or alt, id, file name from src
Notes: Use browser.image("add.gif") for an image with src "/path/to/images/add.gif"

Example:
browser.image("icon.png").click()

Parameters:
Identifier: - can be index, title or alt, id, file name from src
Returns:
a stub representing the element

imageSubmitButton

public ElementStub imageSubmitButton(java.lang.Object... args)
Defines a image submit button.
Usage: browser.image(identifier)
HTML:<input type="image" name="name" id="id" value="value" alt="alt" title="title" src="/images/file.gif">
Identifier:index, tilte/alt, name, id
Notes: (Add support to treat this like browser.image)

Example:
browser.imageSubmitButton("Sign In")

Parameters:
Identifier: - can be index, tilte/alt, name, id
Returns:
a stub representing the element

link

public ElementStub link(java.lang.Object... args)
Defines a link.
Usage: browser.link(identifier)
HTML: <a href="http://u/r/l" id="id">visible text</a>
Identifier: index, visible text, id

Example:
browser.link("Continue").click()

Parameters:
Identifier: - can be index, visible text, id
Returns:
a stub representing the element

password

public ElementStub password(java.lang.Object... args)
Defines a password field.
Usage: browser.password(identifier)
HTML: <input type="password" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.password(0).setValue("!abcd1234")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

radio

public ElementStub radio(java.lang.Object... args)
Defines a radio button.
Usage: browser.radio(identifier)
HTML: <input type="radio" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.radio("Red").click()

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

select

public ElementStub select(java.lang.Object... args)
Defines a select on a drop down.
Usage: browser.select(identifier)
HTML: <select name="name" id="id"></select>
Identifier: index, name, id, className

Example:
browser.select("colors").choose("red")
browser.select("colors").choose(new String[]{"red", "blue"})

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

submit

public ElementStub submit(java.lang.Object... args)
Defines a submit button.
Usage: browser.submit(identifier)
HTML: <input type="submit" name="name" id="id" value="value">
HTML: <button type="submit" name="name" id="id">value</button>
Identifier: index, value, name, id

Example:
browser.submit("Sign in").click()

Parameters:
Identifier: - can be index, value, name, id
Returns:
a stub representing the element

textarea

public ElementStub textarea(java.lang.Object... args)
Defines a textarea.
Usage: browser.textarea(identifier)
HTML: <textarea name="name" id="id">text</textarea>
Identifier: index, name, id, className

Example:
browser.textarea("comments").setValue("A simple comment")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

textbox

public ElementStub textbox(java.lang.Object... args)
Defines a textbox.
Usage: browser.textbox(identifier)
HTML: <input type="textbox" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.textbox("username").setValue("Admin")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

cell

public ElementStub cell(java.lang.Object... args)
Defines a cell.
Usage: browser.cell(identifier)
HTML: <td id="id">text</td>
Identifier: index, id, text

Example:
browser.cell("Click Me").click()
Note: This API also works like this: browser.cell(browser.table("tableId"), "textInRow", "textInColumn").click()

Parameters:
Identifier: - can be index, id, text
Returns:
a stub representing the element

table

public ElementStub table(java.lang.Object... args)
Defines a table.
Usage: browser.table(identifier)
HTML: <table id="id">...</table>
Identifier: index, id

Example:
browser.table("scores")
will return the table identified by "scores"

Parameters:
Identifier: - can be index, id
Returns:
a stub representing the element

byId

public ElementStub byId(java.lang.Object... args)
Defines an element accessed by id.
Usage: browser.byId(identifier)
HTML: <anytag id="id" ></anytag>
Identifier: id
Notes: This can be used for any tag with an id. This API does not accept regular expressions or indexes.
Example:
browser.byId("main_form_button").click()

Parameters:
Identifier: - can be id
Returns:
a stub representing the element

byClassName

public ElementStub byClassName(java.lang.Object... args)
Defines an element accessed by class name.
Usage: byClassName(identifier)
HTML: <anytag class="className">text</anytag>
Identifier: className

Example:
browser.byClassName("rounded-corners-button").click()
will eval to the first button with css id "rounded-corners-button" on the browser then click on it.

Parameters:
Identifier: - can be className
Returns:
a stub representing the element

byXPath

public ElementStub byXPath(java.lang.Object... args)
Defines an element accessed by xpath.
Usage: browser.byXPath(identifier)
Identifier: xpath expression as string
Notes: This is a convenience method for people moving from Selenium or other tools to Sahi.

Example 1:
browser.byXPath("//div/span").click()
will find the element identified by the xpath "//div/span" on the browser then invoke a click on it.

Example 2:
browser.byXPath("//table[3]//tr[1]/td[2]")

Parameters:
Identifier: - can be xpath expression as string
Returns:
a stub representing the element

bySeleniumLocator

public ElementStub bySeleniumLocator(java.lang.Object... args)
Defines a bySeleniumLocator.
Usage: browser.bySeleniumLocator(identifier)

Example:
browser.bySeleniumLocator("//div/span")
will find the element identified by the "//div/span" on the browser according to Selenium's locator strategies.

Parameters:
args -
Returns:
a stub representing the element

row

public ElementStub row(java.lang.Object... args)
Defines a row(tr) within a table element.
Usage: browser.row(identifier)
HTML: <tr><td>te</td><td>xt</td></tr>
Identifier: id, className, text, index

Example:
browser.row(0).in(browser.table("scores"))
will return the 1st row in table identified by "scores"

Parameters:
Identifier: - can be id, className, text, index
Returns:
a stub representing the accessor

div

public ElementStub div(java.lang.Object... args)
Defines a div element.
Usage: browser.div(identifier)
HTML: <div id="id">text</div>
Identifier: index, id, text

Example:
browser.div("Click me").in(browser.table("scores")).click()
will select the 1st row identified by text "Click me" in the table marked "scores" and invoke a click on it.

Parameters:
Identifier: - can be index, id, text
Returns:
a stub representing the accessor

span

public ElementStub span(java.lang.Object... args)
Defines a span element.
Usage: browser.span(identifier)
HTML: <span id="id">text</span>
Identifier: index, id, text

Example:
browser.span("login_btn").click()
will find a span element matching the parameter "login_btn" and then invoke a click on it.

Parameters:
Identifier: - can be index, id, text
Returns:
a stub representing the element

activeElement

public ElementStub activeElement(java.lang.Object... args)
Defines the element in focus.
Usage: browser.activeElement()

Example:
assertEquals("username", browser.activeElement().fetch("id"));

Returns:
a stub representing the element

dList

public ElementStub dList(java.lang.Object... args)
Defines a definition list.
Usage: browser.dList(identifier)
HTML: <dl class=”classname” id=”id”></dl>
Identifier: sahiText, id, className, index

Example:
browser.dList("definitionListId")

Parameters:
Identifier: - can be sahiText, id, className, index
Returns:
a stub representing the element

dTerm

public ElementStub dTerm(java.lang.Object... args)
Defines an item in a definition list.
Usage: browser.dTerm(identifier)
HTML: <dt class=”classname” id=”id”></dt>
Identifier: sahiText, id, className, index

Example:
browser.dTerm("termContent")

Parameters:
Identifier: - can be sahiText, id, className, index
Returns:
a stub representing the element

dDesc

public ElementStub dDesc(java.lang.Object... args)
Defines a description of item in a definition list.
Usage: browser.dDesc(identifier)
HTML: <dd class=”classname” id=”id”></dd>
Identifier: sahiText, id, className, index

Example:
browser.dDesc("description")

Parameters:
Identifier: - can be sahiText, id, className, index
Returns:
a stub representing the element

abbr

public ElementStub abbr(java.lang.Object... args)
Defines an abbreviation.
Usage: browser.abbr(identifier)
HTML: <abbr class="className" id="id">sahiText</abbr>
Identifier: sahiText, title, id, className, index

Example:
browser.abbr("GNU")

Parameters:
Identifier: - can be sahiText, title, id, className, index
Returns:
a stub representing the element

paragraph

public ElementStub paragraph(java.lang.Object... args)
Defines a paragraph element.
Usage: browser.paragraph(identifier)
HTML: <paragraph>text</paragraph>
Identifier: index, id, text

Example:
browser.paragraph("pId").getText()
will return the text contents of the paragraph.

Parameters:
Identifier: - can be id, className, text, index
Returns:
a stub representing the accessor

spandiv

@Deprecated
public ElementStub spandiv(java.lang.Object... args)
Deprecated. 

Defines a spandiv element.
Usage: browser.spandiv(identifier)
HTML: <span id="id">text</span> or <div id="id">text</div>
Identifier: index, id, text

Example:
browser.spandiv("login_btn").click()
will find a span element matching the parameter "login_btn" and then invoke a click on it.

Parameters:
Identifier: - can be index, id, text
Returns:
a stub representing the element

option

public ElementStub option(java.lang.Object... args)
Defines an option element.
Usage: browser.option(identifier)
HTML: <option id="id" value="value">text</option>
Identifier: text, value, id, index

Example:
browser.option("red").click()
will choose "red" from a dropdown.

Parameters:
Identifier: - can be text, value, id, index
Returns:
a stub representing the element

reset

public ElementStub reset(java.lang.Object... args)
Defines a form's reset button.
Usage: browser.reset(identifier)
HTML: <input type="reset" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.reset("Start Over").click()
will click the reset button identified by "Start Over"

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

file

public ElementStub file(java.lang.Object... args)
Defines a file element
Usage: browser.file(identifier)
HTML: <input type="file" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.file("uploadme")
Use with setFile. Eg. browser.file("uploadme").setFile("D:/my/file/path/file.txt")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

byText

public ElementStub byText(java.lang.Object... args)
Identifies an element by text.
Usage: browser.byText(identifier)
HTML: <anytag>text</anytag>
Identifier: text
Notes: This can be used for any tag with text.
Example:
browser.byText("Username", "TD")
will search for an element that matches "Username" within TD tags.

Parameters:
Identifier: - can be text
Returns:
a stub representing the element

cookie

public ElementStub cookie(java.lang.Object... args)
Defines a browser cookie.
Usage: browser.cookie(identifier)

Example:
browser.cookie("session_id")

Parameters:
args -
Returns:
a stub representing the element

position

public ElementStub position(java.lang.Object... args)
Returns position of an element.
Usage: browser.position(identifier)
Notes: Returns an array with the element’s x, y coordinate in pixels.

Example 1:
browser.position(brower.div("id"))
will return the x, y coordinates of the div identified by "id", in pixels

Example 2:
browser.position(browser.div("id")) may return [100, 180]

Parameters:
args -
Returns:
a stub representing the element

label

public ElementStub label(java.lang.Object... args)
Defines a label.
Usage: browser.label(identifier)
HTML: <label id="id">text</label>
Identifier: index, id, text

Example:
browser.label("id")
will return the label identified by "id"

Parameters:
Identifier: - can be index, id, text
Returns:
a stub representing the element

list

public ElementStub list(java.lang.Object... args)
Defines a list.

Example:
browser.list("to_do_items")
will return a list identified by "to_do_items"

Parameters:
args -
Returns:
a stub representing the element

listItem

public ElementStub listItem(java.lang.Object... args)
Defines a listItem.
Usage: browser.lisItem(identifier)
HTML: <li id="id">text</li>
Identifier: index, id, text (

Example:
browser.lisItem("red")
will return the listItem identified by "red".

Parameters:
Identifier: - can be index, id, text
Returns:
a stub representing the element

parentNode

public ElementStub parentNode(java.lang.Object... args)
Defines a parent node.
Usage: browser.parentNode(identifier)
HTML: <div id="id"><a href="">aElement</a></div>

Example:
browser.parentNode(browser.listItem("red"))
will return the parent node in this case, the list element under which listItem "red" is contained

Parameters:
args -
Returns:
a stub representing the element

parentCell

public ElementStub parentCell(java.lang.Object... args)
Defines a parent cell.
Usage: browser.parentCell(identifier)
HTML: <td id="id"><a href="">aElement</a></td>

Example:
browser.parentCell(browser.link("continue"))
will return the parent cell["tr" HTML element] containing the link "continue"

Parameters:
args -
Returns:
a stub representing the element

parentRow

public ElementStub parentRow(java.lang.Object... args)
Defines a parent row.
Usage: browser.parentRow(identifier)
HTML: <tr><td>aCell</td></tr>

Example:
browser.parentRow(browser.cell("red"))
will return the parent row containing the cell containing the text "red"

Parameters:
args -
Returns:
a stub representing the element

parentTable

public ElementStub parentTable(java.lang.Object... args)
Defines a parent table.
Usage: browser.parentTable(identifier)
HTML: <table class="api"><tr><td>sahi</td></tr></table>

Example 1:
browser.parentTable(browser.cell("sahi"))
will return parent table containing the cell identified by "sahi"

Example 2:
browser.parentTable(browser.row("student"))
will return parent table containing the row identified by "student"

Parameters:
args -
Returns:
a stub representing the element

rte

public ElementStub rte(java.lang.Object... args)
Defines rte.
Usage: browser.rte(identifier)
HTML: <iframe src="" name="name" id="id" ></iframe>
Identifier: index, id, name

Example:
browser.rte(0)
will find the first rte(iframe) element on a page.

Parameters:
Identifier: - can be index, id, name
Returns:
a stub representing the element

iframe

public ElementStub iframe(java.lang.Object... args)
Defines an iframe.
Usage: browser.iframe(identifier)
HTML: <iframe src="" name="name" id="id" ></iframe>
Identifier: index, id, name

Example:
browser.iframe("documentation_text").click()
will find an iframe identified by "documentation_text"

Parameters:
Identifier: - can be index, id, name
Returns:
a stub representing the element

tableHeader

public ElementStub tableHeader(java.lang.Object... args)
Defines a table header.
Usage: browser.tableHeader(identifier)
HTML: <th id="id">text</th>
Identifier: text, id

Example:
browser.tableHeader("Price")
will find a table header with text "Price"

Parameters:
Identifier: - can be text, id
Returns:
a stub representing the element

heading1

public ElementStub heading1(java.lang.Object... args)
Defines an h1 element.
Usage: browser.heading1(identifier)
HTML: <h1 id="id">text</h1>
Identifier: text, id

Example:
browser.heading1("Scores")

Parameters:
Identifier: - can be text, id
Returns:
a stub representing the element

heading2

public ElementStub heading2(java.lang.Object... args)
Defines an h2 element.
Usage: browser.heading2(identifier)
HTML: <h2 id="id">text</h2>
Identifier: text, id

Example:
browser.heading2("Scores")
will find an h2 element with text "Scores"

Parameters:
Identifier: - can be text, id
Returns:
a stub representing the element

heading3

public ElementStub heading3(java.lang.Object... args)
Defines an h3 element.
Usage: browser.heading3(identifier)
HTML: <h3 id="id">text</h3>
Identifier: text, id

Example:
browser.heading3("Scores")
will find an h3 element with text "Scores"

Parameters:
Identifier: - can be text, idargs
Returns:
a stub representing the element

heading4

public ElementStub heading4(java.lang.Object... args)
Defines an h4 element.
Usage: browser.heading4(identifier)
HTML: <h4 id="id">text</h4>
Identifier: text, id

Example:
browser.heading4("Scores")
will find an h4 element with text "Scores"

Parameters:
Identifier: - can be text, id
Returns:
a stub representing the element

heading5

public ElementStub heading5(java.lang.Object... args)
Defines an h5 element.
Usage: browser.heading5(identifier)
HTML: <h5 id="id">text</h5>
Identifier: text, id

Example:
browser.heading5("Scores")
will find an h5 element with text "Scores"

Parameters:
Identifier: - can be text, id
Returns:
a stub representing the element

heading6

public ElementStub heading6(java.lang.Object... args)
Defines an h6 element.
Usage: browser.heading6(identifier)
HTML: <h6 id="id">text</h6>
Identifier: text, id

Example:
browser.heading6("Scores")
will find an h6 element with text "Scores"

Parameters:
Identifier: - can be text, id
Returns:
a stub representing the element

hidden

public ElementStub hidden(java.lang.Object... args)
Defines an HTML input element of type hidden.
Usage: browser.hidden(identifier)
HTML: <input type="hidden" name="name" id="id" value="value">
Identifier: index, name, id

Example:
browser.hidden("password")
will find an input element of type "hidden" identified by "password"

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

area

public ElementStub area(java.lang.Object... args)
Defines an area element.
Usage: browser.area(identifier)

Example:
browser.area(0).in(browser.map("planetmap")).click()
will find the first area in the map named "planetmap" and invoke a click on it.

Parameters:
args -
Returns:
a stub representing the element

map

public ElementStub map(java.lang.Object... args)
Defines a map.
Usage: browser.map(identifier)

Example:
browser.map("planetmap")
will return the map identified by "planetmap"

Parameters:
args -
Returns:
a stub representing the element

italic

public ElementStub italic(java.lang.Object... args)
Defines italic.
Usage: browser.italic(identifier)

Example:
browser.italic("Text in Italics")
will return the element with text "text in Italics" which is italicized

Parameters:
args -
Returns:
a stub representing the element

bold

public ElementStub bold(java.lang.Object... args)
Defines bold.
Usage: browser.bold(identifier)

Example:
browser.bold("Text in Bold")
will return the element with text "text in bold" which is in bold

Parameters:
args -
Returns:
a stub representing the element

emphasis

public ElementStub emphasis(java.lang.Object... args)
Defines emphasis.
Usage: browser.emphasis(identifier)

Example:
browser.emphasis("This text is emphasised")
will return the element with text "This text is emphasised" which is emphasised

Parameters:
args -
Returns:
a stub representing the element

strong

public ElementStub strong(java.lang.Object... args)
Defines strong.
Usage: browser.strong(identifier)

Example:
browser.strong("This is strong")
will return the element with text "This is strong" which is strong.

Parameters:
args -
Returns:
a stub representing the element

preformatted

public ElementStub preformatted(java.lang.Object... args)
Defines preformatted.
Usage: browser.preformatted(identifier)

Example:
browser.preformatted("quote_block")
will find the first preformatted element identified by "quote_block"

Parameters:
args -
Returns:
a stub representing the element

code

public ElementStub code(java.lang.Object... args)
Defines code.
Usage: browser.code(identifier)

Example:
browser.code("code_block")
will find the first html code element identified by "code_block"

Parameters:
args -
Returns:
a stub representing the element

blockquote

public ElementStub blockquote(java.lang.Object... args)
Defines block quote.
Usage: browser.blockquote(identifier)

Example:
browser.blockquote("block_quote_element")
will return the html blockquote element identified by "block_quote_element".

Parameters:
args -
Returns:
a stub representing the element

xy

public ElementStub xy(java.lang.Object... args)
Defines xy.
Usage: browser.xy(identifier)
Notes: Specifies the coordinates on element where the event is fired.
Negative values can be given to specify offset from right and bottom.

Example 1:
browser.xy(browser.div("div_id"), 10, 20).click()
will click 10 pixels from the left and 20 pixels from the top of the div, identified by "div_id"

Example 2:
browser.xy(browser.button("id"), -5, -10)).click()
clicks inside the button, 5px from the right and 10px from the bottom.

Parameters:
args -
Returns:
a stub representing the element

datebox

public ElementStub datebox(java.lang.Object... args)
Defines a datebox.
Usage: browser.datebox(identifier)
HTML: <input type="date" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.datebox("today").setValue("2011-09-11")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

datetimebox

public ElementStub datetimebox(java.lang.Object... args)
Defines a datetimebox.
Usage: browser.datetimebox(identifier)
HTML: <input type="datetime" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.datetimebox("today").setValue("2011-09-12T23:56Z")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

datetimelocalbox

public ElementStub datetimelocalbox(java.lang.Object... args)
Defines a datetimelocalbox.
Usage: browser.datetimelocalbox(identifier)
HTML: <input type="datetimelocal" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.datetimelocalbox("today").setValue("2011-09-12T01:00")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

emailbox

public ElementStub emailbox(java.lang.Object... args)
Defines a emailbox.
Usage: browser.emailbox(identifier)
HTML: <input type="email" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.emailbox("username").setValue("a@example.com")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

monthbox

public ElementStub monthbox(java.lang.Object... args)
Defines a monthbox.
Usage: browser.monthbox(identifier)
HTML: <input type="month" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.monthbox("month").setValue("2011-01")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

numberbox

public ElementStub numberbox(java.lang.Object... args)
Defines a numberbox.
Usage: browser.numberbox(identifier)
HTML: <input type="number" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.numberbox("points").setValue("1000")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

rangebox

public ElementStub rangebox(java.lang.Object... args)
Defines a rangebox.
Usage: browser.rangebox(identifier)
HTML: <input type="range" name="name" id="id" value="value" min="1" max="10">
Identifier: index, name, id, className

Example:
browser.rangebox("range").setValue("3")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

searchbox

public ElementStub searchbox(java.lang.Object... args)
Defines a searchbox.
Usage: browser.searchbox(identifier)
HTML: <input type="search" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.searchbox("home").setValue("find me")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

telbox

public ElementStub telbox(java.lang.Object... args)
Defines a telbox.
Usage: browser.telbox(identifier)
HTML: <input type="tel" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.telbox("home").setValue("1212192121")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

timebox

public ElementStub timebox(java.lang.Object... args)
Defines a timebox.
Usage: browser.timebox(identifier)
HTML: <input type="time" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.datebox("username").setValue("10:20:20.000")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

urlbox

public ElementStub urlbox(java.lang.Object... args)
Defines a urlbox.
Usage: browser.urlbox(identifier)
HTML: <input type="url" name="homepage" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.urlbox("homepage").setValue("http://sahipro.com/")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element

weekbox

public ElementStub weekbox(java.lang.Object... args)
Defines a weekbox.
Usage: browser.weekbox(identifier)
HTML: <input type="week" name="name" id="id" value="value">
Identifier: index, name, id, className

Example:
browser.weekbox("week").setValue("2011-W04")

Parameters:
Identifier: - can be index, name, id, className
Returns:
a stub representing the element