selenium.scm Documentation


About This Documentation
Explanation And Examples
Selenium Session
f: new-selenium-session
Internal commands
f: selenium::do-command
f: selenium::get-string
f: selenium::get-number
f: selenium::get-boolean
f: selenium::get-string-array
f: selenium::get-number-array
f: selenium::get-number-array
Starting and Stopping
f: selenium::start
f: selenium::stop
Generated Commands
f: selenium::click
f: selenium::double_click
f: selenium::click_at
f: selenium::double_click_at
f: selenium::fire_event
f: selenium::key_press
f: selenium::shift_key_down
f: selenium::shift_key_up
f: selenium::meta_key_down
f: selenium::meta_key_up
f: selenium::alt_key_down
f: selenium::alt_key_up
f: selenium::control_key_down
f: selenium::control_key_up
f: selenium::key_down
f: selenium::key_up
f: selenium::mouse_over
f: selenium::mouse_out
f: selenium::mouse_down
f: selenium::mouse_down_at
f: selenium::mouse_up
f: selenium::mouse_up_at
f: selenium::mouse_move
f: selenium::mouse_move_at
f: selenium::type
f: selenium::type_keys
f: selenium::set_speed
f: selenium::get_speed
f: selenium::check
f: selenium::uncheck
f: selenium::select
f: selenium::add_selection
f: selenium::remove_selection
f: selenium::remove_all_selections
f: selenium::submit
f: selenium::open
f: selenium::open_window
f: selenium::select_window
f: selenium::select_frame
f: selenium::get_whether_this_frame_match_frame_expression
f: selenium::get_whether_this_window_match_window_expression
f: selenium::wait_for_pop_up
f: selenium::choose_cancel_on_next_confirmation
f: selenium::choose_ok_on_next_confirmation
f: selenium::answer_on_next_prompt
f: selenium::go_back
f: selenium::refresh
f: selenium::close
f: selenium::is_alert_present
f: selenium::is_prompt_present
f: selenium::is_confirmation_present
f: selenium::get_alert
f: selenium::get_confirmation
f: selenium::get_prompt
f: selenium::get_location
f: selenium::get_title
f: selenium::get_body_text
f: selenium::get_value
f: selenium::get_text
f: selenium::highlight
f: selenium::get_eval
f: selenium::is_checked
f: selenium::get_table
f: selenium::get_selected_labels
f: selenium::get_selected_label
f: selenium::get_selected_values
f: selenium::get_selected_value
f: selenium::get_selected_indexes
f: selenium::get_selected_index
f: selenium::get_selected_ids
f: selenium::get_selected_id
f: selenium::is_something_selected
f: selenium::get_select_options
f: selenium::get_attribute
f: selenium::is_text_present
f: selenium::is_element_present
f: selenium::is_visible
f: selenium::is_editable
f: selenium::get_all_buttons
f: selenium::get_all_links
f: selenium::get_all_fields
f: selenium::get_attribute_from_all_windows
f: selenium::dragdrop
f: selenium::set_mouse_speed
f: selenium::get_mouse_speed
f: selenium::drag_and_drop
f: selenium::drag_and_drop_to_object
f: selenium::window_focus
f: selenium::window_maximize
f: selenium::get_all_window_ids
f: selenium::get_all_window_names
f: selenium::get_all_window_titles
f: selenium::get_html_source
f: selenium::set_cursor_position
f: selenium::get_element_index
f: selenium::is_ordered
f: selenium::get_element_position_left
f: selenium::get_element_position_top
f: selenium::get_element_width
f: selenium::get_element_height
f: selenium::get_cursor_position
f: selenium::get_expression
f: selenium::get_xpath_count
f: selenium::assign_id
f: selenium::allow_native_xpath
f: selenium::wait_for_condition
f: selenium::set_timeout
f: selenium::wait_for_page_to_load
f: selenium::wait_for_frame_to_load
f: selenium::get_cookie
f: selenium::create_cookie
f: selenium::delete_cookie
f: selenium::set_browser_log_level
f: selenium::run_script
f: selenium::add_location_strategy
f: selenium::set_context
f: selenium::capture_screenshot

About This Documentation

This file is autogenerated by the iedoc2scm.xml XSLT stylesheet,
using iedoc.xml as the source.  See
http://wiki.openqa.org/display/SRC/Developer%27s+Guide#Developer%27sGuide-IEDoc.js%2CIEDoc.xmlandXSLT
for how to get iedoc.xml

For the rest of the documentation, of which there isn't much
because of the auto-generation, see
http://chicken.wiki.br/selenium


Explanation And Examples

Defines an object that runs Selenium commands.

Element Locators
Element Locators tell Selenium which HTML element a command refers to.
The format of a locator is:
locatorType=argument
We support the following strategies for locating elements:

identifier=id: 
Select the element with the specified @id attribute. If no match is
found, select the first element whose @name attribute is id.
(This is normally the default; see below.)id=id:
Select the element with the specified @id attribute.name=name:
Select the first element with the specified @name attribute.
usernamename=username
The name may optionally be followed by one or more element-filters, separated from the name by whitespace.  If the filterType is not specified, value is assumed.
name=flavour value=chocolate
dom=javascriptExpression: 

Find an element by evaluating the specified string.  This allows you to traverse the HTML Document Object
Model using JavaScript.  Note that you must not return a value in this string; simply make it the last expression in the block.
dom=document.forms['myForm'].myDropdowndom=document.images[56]dom=function foo() { return document.links[1]; }; foo();
xpath=xpathExpression: 
Locate an element using an XPath expression.
xpath=//img[@alt='The image alt text']xpath=//table[@id='table1']//tr[4]/td[2]xpath=//a[contains(@href,'#id1')]xpath=//a[contains(@href,'#id1')]/@classxpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../tdxpath=//input[@name='name2' and @value='yes']xpath=//*[text()="right"]
link=textPattern:
Select the link (anchor) element which contains text matching the
specified pattern.
link=The link text
css=cssSelectorSyntax:
Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
css=a[href="#id3"]css=span#firstChild + span
Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after). 


Without an explicit locator prefix, Selenium uses the following default
strategies:

dom, for locators starting with "document."xpath, for locators starting with "//"identifier, otherwise
Element FiltersElement filters can be used with a locator to refine a list of candidate elements.  They are currently used only in the 'name' element-locator.
Filters look much like locators, ie.
filterType=argumentSupported element-filters are:
value=valuePattern

Matches elements based on their values.  This is particularly useful for refining a list of similarly-named toggle-buttons.index=index

Selects a single element based on its position in the list (offset from zero).String-match Patterns
Various Pattern syntaxes are available for matching string values:

glob:pattern:
Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
kind of limited regular-expression syntax typically used in command-line
shells. In a glob pattern, "*" represents any sequence of characters, and "?"
represents any single character. Glob patterns match against the entire
string.regexp:regexp:
Match a string using a regular-expression. The full power of JavaScript
regular-expressions is available.exact:string:

Match a string exactly, verbatim, without any of that fancy wildcard
stuff.

If no pattern prefix is specified, Selenium assumes that it's a "glob"
pattern.



Selenium Session

The selenium-session record.  Nothing fancy.  All of the values
are start-time options except session-id, which is gotten from the
server at start time.

new-selenium-session

(define (new-selenium-session server-host server-port browser-start-command browser-url #!optional timeout)
... Full Code ... )
This is so we can allow defaults and not force the session id to
be defined.  Timeout is in seconds, and defaults to 30.



Internal commands


selenium::do-command

(define (selenium::do-command sel-sess verb . args)
... Full Code ... )


selenium::get-string

(define (selenium::get-string sel-sess verb . args)
... Full Code ... )
Selenium strings start with "OK,".  The rest is the string.


selenium::get-number

(define (selenium::get-number sel-sess verb . args)
... Full Code ... )
Just turn the Selenium string into a number


selenium::get-boolean

(define (selenium::get-boolean sel-sess verb . args)
... Full Code ... )
Selenium booleans are one of the literal strings "true" and
"false"


selenium::get-string-array

(define (selenium::get-string-array sel-sess verb . args)
... Full Code ... )
Selenium arrays are comma-seperated strings, with \ escapes


selenium::get-number-array

(define (selenium::get-number-array sel-sess verb . args)
... Full Code ... )
Just turn the array bits into numbers


selenium::get-number-array

(define (selenium::get-number-array sel-sess verb . args)
... Full Code ... )
Selenium booleans are one of the literal strings "true" and
"false"; convert all the bits



Starting and Stopping


selenium::start

(define (selenium::start sel-sess)
... Full Code ... )
Start a Selenium session (that is, launch the browser)


selenium::stop

(define (selenium::stop sel-sess)
... Full Code ... )
Stop a Selenium session (that is, close the browser)



Generated Commands


selenium::click

(define (selenium::click sel-sess locator)
... Full Code ... )
Clicks on a link, button, checkbox or radio button. If the click action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator


selenium::double_click

(define (selenium::double_click sel-sess locator)
... Full Code ... )
Double clicks on a link, button, checkbox or radio button. If the double click action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator


selenium::click_at

(define (selenium::click_at sel-sess locator coordString)
... Full Code ... )
Clicks on a link, button, checkbox or radio button. If the click action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.


selenium::double_click_at

(define (selenium::double_click_at sel-sess locator coordString)
... Full Code ... )
Doubleclicks on a link, button, checkbox or radio button. If the action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.


selenium::fire_event

(define (selenium::fire_event sel-sess locator eventName)
... Full Code ... )
Explicitly simulate an event, to trigger the corresponding "onevent"
handler.

'locator' is an element locator
'eventName' is the event name, e.g. "focus" or "blur"


selenium::key_press

(define (selenium::key_press sel-sess locator keySequence)
... Full Code ... )
Simulates a user pressing and releasing a key.

'locator' is an element locator
'keySequence' is Either be a string("\" followed by the numeric keycode  of the key to be pressed, normally the ASCII value of that key), or a single  character. For example: "w", "\119".


selenium::shift_key_down

(define (selenium::shift_key_down sel-sess)
... Full Code ... )
Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.


selenium::shift_key_up

(define (selenium::shift_key_up sel-sess)
... Full Code ... )
Release the shift key.


selenium::meta_key_down

(define (selenium::meta_key_down sel-sess)
... Full Code ... )
Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.


selenium::meta_key_up

(define (selenium::meta_key_up sel-sess)
... Full Code ... )
Release the meta key.


selenium::alt_key_down

(define (selenium::alt_key_down sel-sess)
... Full Code ... )
Press the alt key and hold it down until doAltUp() is called or a new page is loaded.


selenium::alt_key_up

(define (selenium::alt_key_up sel-sess)
... Full Code ... )
Release the alt key.


selenium::control_key_down

(define (selenium::control_key_down sel-sess)
... Full Code ... )
Press the control key and hold it down until doControlUp() is called or a new page is loaded.


selenium::control_key_up

(define (selenium::control_key_up sel-sess)
... Full Code ... )
Release the control key.


selenium::key_down

(define (selenium::key_down sel-sess locator keySequence)
... Full Code ... )
Simulates a user pressing a key (without releasing it yet).

'locator' is an element locator
'keySequence' is Either be a string("\" followed by the numeric keycode  of the key to be pressed, normally the ASCII value of that key), or a single  character. For example: "w", "\119".


selenium::key_up

(define (selenium::key_up sel-sess locator keySequence)
... Full Code ... )
Simulates a user releasing a key.

'locator' is an element locator
'keySequence' is Either be a string("\" followed by the numeric keycode  of the key to be pressed, normally the ASCII value of that key), or a single  character. For example: "w", "\119".


selenium::mouse_over

(define (selenium::mouse_over sel-sess locator)
... Full Code ... )
Simulates a user hovering a mouse over the specified element.

'locator' is an element locator


selenium::mouse_out

(define (selenium::mouse_out sel-sess locator)
... Full Code ... )
Simulates a user moving the mouse pointer away from the specified element.

'locator' is an element locator


selenium::mouse_down

(define (selenium::mouse_down sel-sess locator)
... Full Code ... )
Simulates a user pressing the mouse button (without releasing it yet) on
the specified element.

'locator' is an element locator


selenium::mouse_down_at

(define (selenium::mouse_down_at sel-sess locator coordString)
... Full Code ... )
Simulates a user pressing the mouse button (without releasing it yet) at
the specified location.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.


selenium::mouse_up

(define (selenium::mouse_up sel-sess locator)
... Full Code ... )
Simulates the event that occurs when the user releases the mouse button (i.e., stops
holding the button down) on the specified element.

'locator' is an element locator


selenium::mouse_up_at

(define (selenium::mouse_up_at sel-sess locator coordString)
... Full Code ... )
Simulates the event that occurs when the user releases the mouse button (i.e., stops
holding the button down) at the specified location.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.


selenium::mouse_move

(define (selenium::mouse_move sel-sess locator)
... Full Code ... )
Simulates a user pressing the mouse button (without releasing it yet) on
the specified element.

'locator' is an element locator


selenium::mouse_move_at

(define (selenium::mouse_move_at sel-sess locator coordString)
... Full Code ... )
Simulates a user pressing the mouse button (without releasing it yet) on
the specified element.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.


selenium::type

(define (selenium::type sel-sess locator value)
... Full Code ... )
Sets the value of an input field, as though you typed it in.

Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
value should be the value of the option selected, not the visible text.


'locator' is an element locator
'value' is the value to type


selenium::type_keys

(define (selenium::type_keys sel-sess locator value)
... Full Code ... )
Simulates keystroke events on the specified element, as though you typed the value key-by-key.

This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
Unlike the simple "type" command, which forces the specified value into the page directly, this command
may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
the field.
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
send the keystroke events corresponding to what you just typed.


'locator' is an element locator
'value' is the value to type


selenium::set_speed

(define (selenium::set_speed sel-sess value)
... Full Code ... )
Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation).  By default, there is no such delay, i.e.,
the delay is 0 milliseconds.

'value' is the number of milliseconds to pause after operation


selenium::get_speed

(define (selenium::get_speed sel-sess)
... Full Code ... )
Get execution speed (i.e., get the millisecond length of the delay following each selenium operation).  By default, there is no such delay, i.e.,
the delay is 0 milliseconds.

See also setSpeed.


selenium::check

(define (selenium::check sel-sess locator)
... Full Code ... )
Check a toggle-button (checkbox/radio)

'locator' is an element locator


selenium::uncheck

(define (selenium::uncheck sel-sess locator)
... Full Code ... )
Uncheck a toggle-button (checkbox/radio)

'locator' is an element locator


selenium::select

(define (selenium::select sel-sess selectLocator optionLocator)
... Full Code ... )
Select an option from a drop-down using an option locator.


Option locators provide different ways of specifying options of an HTML
Select element (e.g. for selecting a specific option, or for asserting
that the selected option satisfies a specification). There are several
forms of Select Option Locator.

label=labelPattern:
matches options based on their labels, i.e. the visible text. (This
is the default.)
label=regexp:^[Oo]ther
value=valuePattern:
matches options based on their values.
value=other
id=id:

matches options based on their ids.
id=option1
index=index:
matches an option based on its index (offset from zero).
index=2


If no option locator prefix is provided, the default behaviour is to match on label.



'selectLocator' is an element locator identifying a drop-down menu
'optionLocator' is an option locator (a label by default)


selenium::add_selection

(define (selenium::add_selection sel-sess locator optionLocator)
... Full Code ... )
Add a selection to the set of selected options in a multi-select element using an option locator.

@see #doSelect for details of option locators

'locator' is an element locator identifying a multi-select box
'optionLocator' is an option locator (a label by default)


selenium::remove_selection

(define (selenium::remove_selection sel-sess locator optionLocator)
... Full Code ... )
Remove a selection from the set of selected options in a multi-select element using an option locator.

@see #doSelect for details of option locators

'locator' is an element locator identifying a multi-select box
'optionLocator' is an option locator (a label by default)


selenium::remove_all_selections

(define (selenium::remove_all_selections sel-sess locator)
... Full Code ... )
Unselects all of the selected options in a multi-select element.

'locator' is an element locator identifying a multi-select box


selenium::submit

(define (selenium::submit sel-sess formLocator)
... Full Code ... )
Submit the specified form. This is particularly useful for forms without
submit buttons, e.g. single-input "Search" forms.

'formLocator' is an element locator for the form you want to submit


selenium::open

(define (selenium::open sel-sess url)
... Full Code ... )
Opens an URL in the test frame. This accepts both relative and absolute
URLs.

The "open" command waits for the page to load before proceeding,
ie. the "AndWait" suffix is implicit.

Note: The URL must be on the same domain as the runner HTML
due to security restrictions in the browser (Same Origin Policy). If you
need to open an URL on another domain, use the Selenium Server to start a
new browser session on that domain.

'url' is the URL to open; may be relative or absolute


selenium::open_window

(define (selenium::open_window sel-sess url windowID)
... Full Code ... )
Opens a popup window (if a window with that ID isn't already open).
After opening the window, you'll need to select it using the selectWindow
command.

This command can also be a useful workaround for bug SEL-339.  In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
an empty (blank) url, like this: openWindow("", "myFunnyWindow").


'url' is the URL to open, which can be blank
'windowID' is the JavaScript window ID of the window to select


selenium::select_window

(define (selenium::select_window sel-sess windowID)
... Full Code ... )
Selects a popup window; once a popup window has been selected, all
commands go to that window. To select the main window again, use null
as the target.

Note that there is a big difference between a window's internal JavaScript "name" property
and the "title" of a given window's document (which is normally what you actually see, as an end user,
in the title bar of the window).  The "name" is normally invisible to the end-user; it's the second 
parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
(which selenium intercepts).
Selenium has several strategies for finding the window object referred to by the "windowID" parameter.
1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
that this variable contains the return value from a call to the JavaScript window.open() method.
3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title".
Since "title" is not necessarily unique, this may have unexpected behavior.
If you're having trouble figuring out what is the name of a window that you want to manipulate, look at the selenium log messages
which identify the names of windows created via window.open (and therefore intercepted by selenium).  You will see messages
like the following for each window as it is opened:
debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"
In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
(This is bug SEL-339.)  In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
an empty (blank) url, like this: openWindow("", "myFunnyWindow").


'windowID' is the JavaScript window ID of the window to select


selenium::select_frame

(define (selenium::select_frame sel-sess locator)
... Full Code ... )
Selects a frame within the current window.  (You may invoke this command
multiple times to select nested frames.)  To select the parent frame, use
"relative=parent" as a locator; to select the top frame, use "relative=top".
You can also select a frame by its 0-based index number; select the first frame with
"index=0", or the third frame with "index=2".

You may also use a DOM expression to identify the frame you want directly,
like this: dom=frames["main"].frames["subframe"]


'locator' is an element locator identifying a frame or iframe


selenium::get_whether_this_frame_match_frame_expression

(define (selenium::get_whether_this_frame_match_frame_expression sel-sess currentFrameString target)
... Full Code ... )
Determine whether current/locator identify the frame containing this running code.

This is useful in proxy injection mode, where this code runs in every
browser frame and window, and sometimes the selenium server needs to identify
the "current" frame.  In this case, when the test calls selectFrame, this
routine is called for each frame to figure out which one has been selected.
The selected frame will return true, while all others will return false.


'currentFrameString' is starting frame
'target' is new frame (which might be relative to the current one)


selenium::get_whether_this_window_match_window_expression

(define (selenium::get_whether_this_window_match_window_expression sel-sess currentWindowString target)
... Full Code ... )
Determine whether currentWindowString plus target identify the window containing this running code.

This is useful in proxy injection mode, where this code runs in every
browser frame and window, and sometimes the selenium server needs to identify
the "current" window.  In this case, when the test calls selectWindow, this
routine is called for each window to figure out which one has been selected.
The selected window will return true, while all others will return false.


'currentWindowString' is starting window
'target' is new window (which might be relative to the current one, e.g., "_parent")


selenium::wait_for_pop_up

(define (selenium::wait_for_pop_up sel-sess windowID timeout)
... Full Code ... )
Waits for a popup window to appear and load up.

'windowID' is the JavaScript window ID of the window that will appear
'timeout' is a timeout in milliseconds, after which the action will return with an error


selenium::choose_cancel_on_next_confirmation

(define (selenium::choose_cancel_on_next_confirmation sel-sess)
... Full Code ... )
By default, Selenium's overridden window.confirm() function will
return true, as if the user had manually clicked OK; after running
this command, the next call to confirm() will return false, as if
the user had clicked Cancel.  Selenium will then resume using the
default behavior for future confirmations, automatically returning 
true (OK) unless/until you explicitly call this command for each
confirmation.


selenium::choose_ok_on_next_confirmation

(define (selenium::choose_ok_on_next_confirmation sel-sess)
... Full Code ... )
Undo the effect of calling chooseCancelOnNextConfirmation.  Note
that Selenium's overridden window.confirm() function will normally automatically
return true, as if the user had manually clicked OK, so you shouldn't
need to use this command unless for some reason you need to change
your mind prior to the next confirmation.  After any confirmation, Selenium will resume using the
default behavior for future confirmations, automatically returning 
true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
confirmation.


selenium::answer_on_next_prompt

(define (selenium::answer_on_next_prompt sel-sess answer)
... Full Code ... )
Instructs Selenium to return the specified answer string in response to
the next JavaScript prompt [window.prompt()].

'answer' is the answer to give in response to the prompt pop-up


selenium::go_back

(define (selenium::go_back sel-sess)
... Full Code ... )
Simulates the user clicking the "back" button on their browser.


selenium::refresh

(define (selenium::refresh sel-sess)
... Full Code ... )
Simulates the user clicking the "Refresh" button on their browser.


selenium::close

(define (selenium::close sel-sess)
... Full Code ... )
Simulates the user clicking the "close" button in the titlebar of a popup
window or tab.


selenium::is_alert_present

(define (selenium::is_alert_present sel-sess)
... Full Code ... )
Has an alert occurred?


This function never throws an exception




selenium::is_prompt_present

(define (selenium::is_prompt_present sel-sess)
... Full Code ... )
Has a prompt occurred?


This function never throws an exception




selenium::is_confirmation_present

(define (selenium::is_confirmation_present sel-sess)
... Full Code ... )
Has confirm() been called?


This function never throws an exception




selenium::get_alert

(define (selenium::get_alert sel-sess)
... Full Code ... )
Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.

Getting an alert has the same effect as manually clicking OK. If an
alert is generated but you do not get/verify it, the next Selenium action
will fail.
NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
dialog.
NOTE: Selenium does NOT support JavaScript alerts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.



selenium::get_confirmation

(define (selenium::get_confirmation sel-sess)
... Full Code ... )
Retrieves the message of a JavaScript confirmation dialog generated during
the previous action.


By default, the confirm function will return true, having the same effect
as manually clicking OK. This can be changed by prior execution of the
chooseCancelOnNextConfirmation command. If an confirmation is generated
but you do not get/verify it, the next Selenium action will fail.


NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
dialog.


NOTE: Selenium does NOT support JavaScript confirmations that are
generated in a page's onload() event handler. In this case a visible
dialog WILL be generated and Selenium will hang until you manually click
OK.




selenium::get_prompt

(define (selenium::get_prompt sel-sess)
... Full Code ... )
Retrieves the message of a JavaScript question prompt dialog generated during
the previous action.

Successful handling of the prompt requires prior execution of the
answerOnNextPrompt command. If a prompt is generated but you
do not get/verify it, the next Selenium action will fail.
NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
dialog.
NOTE: Selenium does NOT support JavaScript prompts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.



selenium::get_location

(define (selenium::get_location sel-sess)
... Full Code ... )
Gets the absolute URL of the current page.


selenium::get_title

(define (selenium::get_title sel-sess)
... Full Code ... )
Gets the title of the current page.


selenium::get_body_text

(define (selenium::get_body_text sel-sess)
... Full Code ... )
Gets the entire text of the page.


selenium::get_value

(define (selenium::get_value sel-sess locator)
... Full Code ... )
Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
For checkbox/radio elements, the value will be "on" or "off" depending on
whether the element is checked or not.

'locator' is an element locator


selenium::get_text

(define (selenium::get_text sel-sess locator)
... Full Code ... )
Gets the text of an element. This works for any element that contains
text. This command uses either the textContent (Mozilla-like browsers) or
the innerText (IE-like browsers) of the element, which is the rendered
text shown to the user.

'locator' is an element locator


selenium::highlight

(define (selenium::highlight sel-sess locator)
... Full Code ... )
Briefly changes the backgroundColor of the specified element yellow.  Useful for debugging.

'locator' is an element locator


selenium::get_eval

(define (selenium::get_eval sel-sess script)
... Full Code ... )
Gets the result of evaluating the specified JavaScript snippet.  The snippet may
have multiple lines, but only the result of the last line will be returned.

Note that, by default, the snippet will run in the context of the "selenium"
object itself, so this will refer to the Selenium object.  Use window to
refer to the window of your application, e.g. window.document.getElementById('foo')
If you need to use
a locator to refer to a single element in your application page, you can
use this.browserbot.findElement("id=foo") where "id=foo" is your locator.


'script' is the JavaScript snippet to run


selenium::is_checked

(define (selenium::is_checked sel-sess locator)
... Full Code ... )
Gets whether a toggle-button (checkbox/radio) is checked.  Fails if the specified element doesn't exist or isn't a toggle-button.

'locator' is an element locator pointing to a checkbox or radio button


selenium::get_table

(define (selenium::get_table sel-sess tableCellAddress)
... Full Code ... )
Gets the text from a cell of a table. The cellAddress syntax
tableLocator.row.column, where row and column start at 0.

'tableCellAddress' is a cell address, e.g. "foo.1.4"


selenium::get_selected_labels

(define (selenium::get_selected_labels sel-sess selectLocator)
... Full Code ... )
Gets all option labels (visible text) for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_label

(define (selenium::get_selected_label sel-sess selectLocator)
... Full Code ... )
Gets option label (visible text) for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_values

(define (selenium::get_selected_values sel-sess selectLocator)
... Full Code ... )
Gets all option values (value attributes) for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_value

(define (selenium::get_selected_value sel-sess selectLocator)
... Full Code ... )
Gets option value (value attribute) for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_indexes

(define (selenium::get_selected_indexes sel-sess selectLocator)
... Full Code ... )
Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_index

(define (selenium::get_selected_index sel-sess selectLocator)
... Full Code ... )
Gets option index (option number, starting at 0) for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_ids

(define (selenium::get_selected_ids sel-sess selectLocator)
... Full Code ... )
Gets all option element IDs for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_selected_id

(define (selenium::get_selected_id sel-sess selectLocator)
... Full Code ... )
Gets option element ID for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu


selenium::is_something_selected

(define (selenium::is_something_selected sel-sess selectLocator)
... Full Code ... )
Determines whether some option in a drop-down menu is selected.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_select_options

(define (selenium::get_select_options sel-sess selectLocator)
... Full Code ... )
Gets all option labels in the specified select drop-down.

'selectLocator' is an element locator identifying a drop-down menu


selenium::get_attribute

(define (selenium::get_attribute sel-sess attributeLocator)
... Full Code ... )
Gets the value of an element attribute.

'attributeLocator' is an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"


selenium::is_text_present

(define (selenium::is_text_present sel-sess pattern)
... Full Code ... )
Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.

'pattern' is a pattern to match with the text of the page


selenium::is_element_present

(define (selenium::is_element_present sel-sess locator)
... Full Code ... )
Verifies that the specified element is somewhere on the page.

'locator' is an element locator


selenium::is_visible

(define (selenium::is_visible sel-sess locator)
... Full Code ... )
Determines if the specified element is visible. An
element can be rendered invisible by setting the CSS "visibility"
property to "hidden", or the "display" property to "none", either for the
element itself or one if its ancestors.  This method will fail if
the element is not present.

'locator' is an element locator


selenium::is_editable

(define (selenium::is_editable sel-sess locator)
... Full Code ... )
Determines whether the specified input element is editable, ie hasn't been disabled.
This method will fail if the specified element isn't an input element.

'locator' is an element locator


selenium::get_all_buttons

(define (selenium::get_all_buttons sel-sess)
... Full Code ... )
Returns the IDs of all buttons on the page.

If a given button has no ID, it will appear as "" in this array.



selenium::get_all_links

(define (selenium::get_all_links sel-sess)
... Full Code ... )
Returns the IDs of all links on the page.

If a given link has no ID, it will appear as "" in this array.



selenium::get_all_fields

(define (selenium::get_all_fields sel-sess)
... Full Code ... )
Returns the IDs of all input fields on the page.

If a given field has no ID, it will appear as "" in this array.



selenium::get_attribute_from_all_windows

(define (selenium::get_attribute_from_all_windows sel-sess attributeName)
... Full Code ... )
Returns every instance of some attribute from all known windows.

'attributeName' is name of an attribute on the windows


selenium::dragdrop

(define (selenium::dragdrop sel-sess locator movementsString)
... Full Code ... )
deprecated - use dragAndDrop instead

'locator' is an element locator
'movementsString' is offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"


selenium::set_mouse_speed

(define (selenium::set_mouse_speed sel-sess pixels)
... Full Code ... )
Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
in between the start location and the end location; that can be very slow, and may
cause some browsers to force the JavaScript to timeout.
If the mouse speed is greater than the distance between the two dragged objects, we'll
just send one "mousemove" at the start location and then one final one at the end location.


'pixels' is the number of pixels between "mousemove" events


selenium::get_mouse_speed

(define (selenium::get_mouse_speed sel-sess)
... Full Code ... )
Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).


selenium::drag_and_drop

(define (selenium::drag_and_drop sel-sess locator movementsString)
... Full Code ... )
Drags an element a certain distance and then drops it

'locator' is an element locator
'movementsString' is offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"


selenium::drag_and_drop_to_object

(define (selenium::drag_and_drop_to_object sel-sess locatorOfObjectToBeDragged locatorOfDragDestinationObject)
... Full Code ... )
Drags an element and drops it on another element

'locatorOfObjectToBeDragged' is an element to be dragged
'locatorOfDragDestinationObject' is an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged  is dropped


selenium::window_focus

(define (selenium::window_focus sel-sess)
... Full Code ... )
Gives focus to the currently selected window


selenium::window_maximize

(define (selenium::window_maximize sel-sess)
... Full Code ... )
Resize currently selected window to take up the entire screen


selenium::get_all_window_ids

(define (selenium::get_all_window_ids sel-sess)
... Full Code ... )
Returns the IDs of all windows that the browser knows about.


selenium::get_all_window_names

(define (selenium::get_all_window_names sel-sess)
... Full Code ... )
Returns the names of all windows that the browser knows about.


selenium::get_all_window_titles

(define (selenium::get_all_window_titles sel-sess)
... Full Code ... )
Returns the titles of all windows that the browser knows about.


selenium::get_html_source

(define (selenium::get_html_source sel-sess)
... Full Code ... )
Returns the entire HTML source between the opening and
closing "html" tags.


selenium::set_cursor_position

(define (selenium::set_cursor_position sel-sess locator position)
... Full Code ... )
Moves the text cursor to the specified position in the given input element or textarea.
This method will fail if the specified element isn't an input element or textarea.

'locator' is an element locator pointing to an input element or textarea
'position' is the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field.  You can also set the cursor to -1 to move it to the end of the field.


selenium::get_element_index

(define (selenium::get_element_index sel-sess locator)
... Full Code ... )
Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
will be ignored.

'locator' is an element locator pointing to an element


selenium::is_ordered

(define (selenium::is_ordered sel-sess locator1 locator2)
... Full Code ... )
Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
not be considered ordered.

'locator1' is an element locator pointing to the first element
'locator2' is an element locator pointing to the second element


selenium::get_element_position_left

(define (selenium::get_element_position_left sel-sess locator)
... Full Code ... )
Retrieves the horizontal position of an element

'locator' is an element locator pointing to an element OR an element itself


selenium::get_element_position_top

(define (selenium::get_element_position_top sel-sess locator)
... Full Code ... )
Retrieves the vertical position of an element

'locator' is an element locator pointing to an element OR an element itself


selenium::get_element_width

(define (selenium::get_element_width sel-sess locator)
... Full Code ... )
Retrieves the width of an element

'locator' is an element locator pointing to an element


selenium::get_element_height

(define (selenium::get_element_height sel-sess locator)
... Full Code ... )
Retrieves the height of an element

'locator' is an element locator pointing to an element


selenium::get_cursor_position

(define (selenium::get_cursor_position sel-sess locator)
... Full Code ... )
Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.

Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
return the position of the last location of the cursor, even though the cursor is now gone from the page.  This is filed as SEL-243.

This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.

'locator' is an element locator pointing to an input element or textarea


selenium::get_expression

(define (selenium::get_expression sel-sess expression)
... Full Code ... )
Returns the specified expression.

This is useful because of JavaScript preprocessing.
It is used to generate commands like assertExpression and waitForExpression.


'expression' is the value to return


selenium::get_xpath_count

(define (selenium::get_xpath_count sel-sess xpath)
... Full Code ... )
Returns the number of nodes that match the specified xpath, eg. "//table" would give
the number of tables.

'xpath' is the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.


selenium::assign_id

(define (selenium::assign_id sel-sess locator identifier)
... Full Code ... )
Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
using its ID rather than a slow/complicated XPath.  This ID will disappear once the page is
reloaded.

'locator' is an element locator pointing to an element
'identifier' is a string to be used as the ID of the specified element


selenium::allow_native_xpath

(define (selenium::allow_native_xpath sel-sess allow)
... Full Code ... )
Specifies whether Selenium should use the native in-browser implementation
of XPath (if any native version is available); if you pass "false" to
this function, we will always use our pure-JavaScript xpath library.
Using the pure-JS xpath library can improve the consistency of xpath
element locators between different browser vendors, but the pure-JS
version is much slower than the native implementations.

'allow' is boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath


selenium::wait_for_condition

(define (selenium::wait_for_condition sel-sess script timeout)
... Full Code ... )
Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
The snippet may have multiple lines, but only the result of the last line
will be considered.

Note that, by default, the snippet will be run in the runner's test window, not in the window
of your application.  To get the window of your application, you can use
the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then
run your JavaScript in there


'script' is the JavaScript snippet to run
'timeout' is a timeout in milliseconds, after which this command will return with an error


selenium::set_timeout

(define (selenium::set_timeout sel-sess timeout)
... Full Code ... )
Specifies the amount of time that Selenium will wait for actions to complete.

Actions that require waiting include "open" and the "waitFor*" actions.

The default timeout is 30 seconds.

'timeout' is a timeout in milliseconds, after which the action will return with an error


selenium::wait_for_page_to_load

(define (selenium::wait_for_page_to_load sel-sess timeout)
... Full Code ... )
Waits for a new page to load.

You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
(which are only available in the JS API).
Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
flag when it first notices a page load.  Running any other Selenium command after
turns the flag to false.  Hence, if you want to wait for a page to load, you must
wait immediately after a Selenium command that caused a page-load.


'timeout' is a timeout in milliseconds, after which this command will return with an error


selenium::wait_for_frame_to_load

(define (selenium::wait_for_frame_to_load sel-sess frameAddress timeout)
... Full Code ... )
Waits for a new frame to load.

Selenium constantly keeps track of new pages and frames loading, 
and sets a "newPageLoaded" flag when it first notices a page load.


See waitForPageToLoad for more information.

'frameAddress' is FrameAddress from the server side
'timeout' is a timeout in milliseconds, after which this command will return with an error


selenium::get_cookie

(define (selenium::get_cookie sel-sess)
... Full Code ... )
Return all cookies of the current page under test.


selenium::create_cookie

(define (selenium::create_cookie sel-sess nameValuePair optionsString)
... Full Code ... )
Create a new cookie whose path and domain are same with those of current page
under test, unless you specified a path for this cookie explicitly.

'nameValuePair' is name and value of the cookie in a format "name=value"
'optionsString' is options for the cookie. Currently supported options include 'path' and 'max_age'.      the optionsString's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit      of the value of 'max_age' is second.


selenium::delete_cookie

(define (selenium::delete_cookie sel-sess name path)
... Full Code ... )
Delete a named cookie with specified path.

'name' is the name of the cookie to be deleted
'path' is the path property of the cookie to be deleted


selenium::set_browser_log_level

(define (selenium::set_browser_log_level sel-sess logLevel)
... Full Code ... )
Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
To see the browser logs, you need to
either show the log window in GUI mode, or enable browser-side logging in Selenium RC.

'logLevel' is one of the following: "debug", "info", "warn", "error" or "off"


selenium::run_script

(define (selenium::run_script sel-sess script)
... Full Code ... )
Creates a new "script" tag in the body of the current test window, and 
adds the specified text into the body of the command.  Scripts run in
this way can often be debugged more easily than scripts executed using
Selenium's "getEval" command.  Beware that JS exceptions thrown in these script
tags aren't managed by Selenium, so you should probably wrap your script
in try/catch blocks if there is any chance that the script will throw
an exception.

'script' is the JavaScript snippet to run


selenium::add_location_strategy

(define (selenium::add_location_strategy sel-sess strategyName functionDefinition)
... Full Code ... )
Defines a new function for Selenium to locate elements on the page.
For example,
if you define the strategy "foo", and someone runs click("foo=blah"), we'll
run your function, passing you the string "blah", and click on the element 
that your function
returns, or throw an "Element not found" error if your function returns null.

We'll pass three arguments to your function:
locator: the string the user passed ininWindow: the currently selected windowinDocument: the currently selected document

The function must return null if the element can't be found.

'strategyName' is the name of the strategy to define; this should use only   letters [a-zA-Z] with no spaces or other punctuation.
'functionDefinition' is a string defining the body of a function in JavaScript.   For example: return inDocument.getElementById(locator);


selenium::set_context

(define (selenium::set_context sel-sess context)
... Full Code ... )
Writes a message to the status bar and adds a note to the browser-side
log.

'context' is the message to be sent to the browser


selenium::capture_screenshot

(define (selenium::capture_screenshot sel-sess filename)
... Full Code ... )
Captures a PNG screenshot to the specified file.

'filename' is the absolute path to the file to be written, e.g. "c:\blah\screenshot.png"


Code

define-record
Index
(define-record
    selenium-session
    server-host
    server-port
    browser-start-command
    browser-url
    timeout
    session-id)

new-selenium-session

Index
This is so we can allow defaults and not force the session id to
be defined.  Timeout is in seconds, and defaults to 30.
(define (new-selenium-session
	  server-host
	  server-port
	  browser-start-command
	  browser-url
	  #!optional timeout)
  (make-selenium-session
    server-host
    server-port
    browser-start-command
    browser-url
    (or timeout 30)
    #f))

selenium::do-command

Index
(define (selenium::do-command sel-sess verb . args)
  ;(format #t "d-c args: ~A\n" args)
  (let*
    (
     [url
       (uri->string
	 (make-uri
	   scheme: 'http
	   ; List of authority, path, query.  Authority is in turn
	   ; userinfo, host, port.
	   specific: (list
		       (list
			 #f
			 (selenium-session-server-host sel-sess)
			 (selenium-session-server-port sel-sess))
		       "/selenium-server/driver/"
		       ; Create an alist of the arguments.  The
		       ; session-id we may or may not want to
		       ; populate, depending on whether we have one
		       ; yet.
		       (let
			 ([main-list
			    (cons
			      (cons "cmd" verb)
			      (cond
				[(null? args) '()]
				[(and (null? (car args)) (null? (cdr args))) '()]
				[else (map
					(lambda (a b) (cons a b))
					(iota (length args) 1)
					args)]))])
			 ; Add the session ID, or not.
			 (cond
			   [(selenium-session-session-id sel-sess)
			    (append
			      main-list
			      (list (cons "sessionId" (selenium-session-session-id sel-sess))))]
			   [else main-list])))))]
     [http-thread (make-thread (lambda ()
				 (http:GET (http:make-request
					     'GET url
					     '(("Connection" . "close"))
					     '() "" 'HTTP/1.1))))]
     [result (begin
	       (thread-start! http-thread)
	       ;(format #t "start done.\n")
	       (thread-join! http-thread (selenium-session-timeout sel-sess) #f))])
    ;(format #t "do-command verb: ~A.\n" verb)
    ;(format #t "do-command args: ~A.\n" args)
    ;(format #t "do-command url: ~A.\n" url)
    ;(format #t "do-command output: ~A.\n" result)
    result))

selenium::get-string

Index
Selenium strings start with "OK,".  The rest is the string.
(define (selenium::get-string sel-sess verb . args)
  (string-drop (apply selenium::do-command sel-sess verb args) 3))

selenium::get-number

Index
Just turn the Selenium string into a number
(define (selenium::get-number sel-sess verb . args)
  (string->number (apply selenium::get-string sel-sess verb args)))

selenium::get-boolean

Index
Selenium booleans are one of the literal strings "true" and
"false"
(define (selenium::get-boolean sel-sess verb . args)
  (let
    ([str (apply selenium::get-string sel-sess verb args)])
    ; We let cond throw an exception if neither string matches
    (cond
      [(string=? "true" str) #t]
      [(string=? "false" str) #f])))

selenium::get-string-array

Index
Selenium arrays are comma-seperated strings, with \ escapes
(define (selenium::get-string-array sel-sess verb . args)
  (map
    (lambda (str)
      (string-substitute "(?

selenium::get-number-array

Index
Just turn the array bits into numbers
(define (selenium::get-number-array sel-sess verb . args)
  (map
    string->number
    (apply selenium::get-string-array sel-sess verb args)))

selenium::get-number-array

Index
Selenium booleans are one of the literal strings "true" and
"false"; convert all the bits
(define (selenium::get-number-array sel-sess verb . args)
  (map
    (lambda (str)
      (cond
	[(string=? "true" str) #t]
	[(string=? "false" str) #f]))
    (apply selenium::get-string-array sel-sess verb args)))

selenium::start

Index
Start a Selenium session (that is, launch the browser)
(define (selenium::start sel-sess)
  (selenium-session-session-id-set!
    sel-sess
    (selenium::get-string
      sel-sess
      "getNewBrowserSession"
      (selenium-session-browser-start-command sel-sess)
      (selenium-session-browser-url sel-sess))))

selenium::stop

Index
Stop a Selenium session (that is, close the browser)
(define (selenium::stop sel-sess)
  (selenium::do-command sel-sess "testComplete" '())
  (selenium-session-session-id-set! sel-sess #f))

selenium::click

Index
Clicks on a link, button, checkbox or radio button. If the click action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator
(define (selenium::click sel-sess locator)
            (selenium::do-command sel-sess "click" locator ))


selenium::double_click

Index
Double clicks on a link, button, checkbox or radio button. If the double click action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator
(define (selenium::double_click sel-sess locator)
            (selenium::do-command sel-sess "doubleClick" locator ))


selenium::click_at

Index
Clicks on a link, button, checkbox or radio button. If the click action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.
(define (selenium::click_at sel-sess locator coordString)
            (selenium::do-command sel-sess "clickAt" locator coordString ))


selenium::double_click_at

Index
Doubleclicks on a link, button, checkbox or radio button. If the action
causes a new page to load (like a link usually does), call
waitForPageToLoad.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.
(define (selenium::double_click_at sel-sess locator coordString)
            (selenium::do-command sel-sess "doubleClickAt" locator coordString ))


selenium::fire_event

Index
Explicitly simulate an event, to trigger the corresponding "onevent"
handler.

'locator' is an element locator
'eventName' is the event name, e.g. "focus" or "blur"
(define (selenium::fire_event sel-sess locator eventName)
            (selenium::do-command sel-sess "fireEvent" locator eventName ))


selenium::key_press

Index
Simulates a user pressing and releasing a key.

'locator' is an element locator
'keySequence' is Either be a string("\" followed by the numeric keycode  of the key to be pressed, normally the ASCII value of that key), or a single  character. For example: "w", "\119".
(define (selenium::key_press sel-sess locator keySequence)
            (selenium::do-command sel-sess "keyPress" locator keySequence ))


selenium::shift_key_down

Index
Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.

(define (selenium::shift_key_down sel-sess )
            (selenium::do-command sel-sess "shiftKeyDown" ))


selenium::shift_key_up

Index
Release the shift key.

(define (selenium::shift_key_up sel-sess )
            (selenium::do-command sel-sess "shiftKeyUp" ))


selenium::meta_key_down

Index
Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.

(define (selenium::meta_key_down sel-sess )
            (selenium::do-command sel-sess "metaKeyDown" ))


selenium::meta_key_up

Index
Release the meta key.

(define (selenium::meta_key_up sel-sess )
            (selenium::do-command sel-sess "metaKeyUp" ))


selenium::alt_key_down

Index
Press the alt key and hold it down until doAltUp() is called or a new page is loaded.

(define (selenium::alt_key_down sel-sess )
            (selenium::do-command sel-sess "altKeyDown" ))


selenium::alt_key_up

Index
Release the alt key.

(define (selenium::alt_key_up sel-sess )
            (selenium::do-command sel-sess "altKeyUp" ))


selenium::control_key_down

Index
Press the control key and hold it down until doControlUp() is called or a new page is loaded.

(define (selenium::control_key_down sel-sess )
            (selenium::do-command sel-sess "controlKeyDown" ))


selenium::control_key_up

Index
Release the control key.

(define (selenium::control_key_up sel-sess )
            (selenium::do-command sel-sess "controlKeyUp" ))


selenium::key_down

Index
Simulates a user pressing a key (without releasing it yet).

'locator' is an element locator
'keySequence' is Either be a string("\" followed by the numeric keycode  of the key to be pressed, normally the ASCII value of that key), or a single  character. For example: "w", "\119".
(define (selenium::key_down sel-sess locator keySequence)
            (selenium::do-command sel-sess "keyDown" locator keySequence ))


selenium::key_up

Index
Simulates a user releasing a key.

'locator' is an element locator
'keySequence' is Either be a string("\" followed by the numeric keycode  of the key to be pressed, normally the ASCII value of that key), or a single  character. For example: "w", "\119".
(define (selenium::key_up sel-sess locator keySequence)
            (selenium::do-command sel-sess "keyUp" locator keySequence ))


selenium::mouse_over

Index
Simulates a user hovering a mouse over the specified element.

'locator' is an element locator
(define (selenium::mouse_over sel-sess locator)
            (selenium::do-command sel-sess "mouseOver" locator ))


selenium::mouse_out

Index
Simulates a user moving the mouse pointer away from the specified element.

'locator' is an element locator
(define (selenium::mouse_out sel-sess locator)
            (selenium::do-command sel-sess "mouseOut" locator ))


selenium::mouse_down

Index
Simulates a user pressing the mouse button (without releasing it yet) on
the specified element.

'locator' is an element locator
(define (selenium::mouse_down sel-sess locator)
            (selenium::do-command sel-sess "mouseDown" locator ))


selenium::mouse_down_at

Index
Simulates a user pressing the mouse button (without releasing it yet) at
the specified location.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.
(define (selenium::mouse_down_at sel-sess locator coordString)
            (selenium::do-command sel-sess "mouseDownAt" locator coordString ))


selenium::mouse_up

Index
Simulates the event that occurs when the user releases the mouse button (i.e., stops
holding the button down) on the specified element.

'locator' is an element locator
(define (selenium::mouse_up sel-sess locator)
            (selenium::do-command sel-sess "mouseUp" locator ))


selenium::mouse_up_at

Index
Simulates the event that occurs when the user releases the mouse button (i.e., stops
holding the button down) at the specified location.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.
(define (selenium::mouse_up_at sel-sess locator coordString)
            (selenium::do-command sel-sess "mouseUpAt" locator coordString ))


selenium::mouse_move

Index
Simulates a user pressing the mouse button (without releasing it yet) on
the specified element.

'locator' is an element locator
(define (selenium::mouse_move sel-sess locator)
            (selenium::do-command sel-sess "mouseMove" locator ))


selenium::mouse_move_at

Index
Simulates a user pressing the mouse button (without releasing it yet) on
the specified element.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of the mouse      event relative to the element returned by the locator.
(define (selenium::mouse_move_at sel-sess locator coordString)
            (selenium::do-command sel-sess "mouseMoveAt" locator coordString ))


selenium::type

Index
Sets the value of an input field, as though you typed it in.

Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
value should be the value of the option selected, not the visible text.


'locator' is an element locator
'value' is the value to type
(define (selenium::type sel-sess locator value)
            (selenium::do-command sel-sess "type" locator value ))


selenium::type_keys

Index
Simulates keystroke events on the specified element, as though you typed the value key-by-key.

This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
Unlike the simple "type" command, which forces the specified value into the page directly, this command
may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
the field.
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
send the keystroke events corresponding to what you just typed.


'locator' is an element locator
'value' is the value to type
(define (selenium::type_keys sel-sess locator value)
            (selenium::do-command sel-sess "typeKeys" locator value ))


selenium::set_speed

Index
Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation).  By default, there is no such delay, i.e.,
the delay is 0 milliseconds.

'value' is the number of milliseconds to pause after operation
(define (selenium::set_speed sel-sess value)
            (selenium::do-command sel-sess "setSpeed" value ))


selenium::get_speed

Index
Get execution speed (i.e., get the millisecond length of the delay following each selenium operation).  By default, there is no such delay, i.e.,
the delay is 0 milliseconds.

See also setSpeed.

(define (selenium::get_speed sel-sess )
            (selenium::do-command sel-sess "getSpeed" ))


selenium::check

Index
Check a toggle-button (checkbox/radio)

'locator' is an element locator
(define (selenium::check sel-sess locator)
            (selenium::do-command sel-sess "check" locator ))


selenium::uncheck

Index
Uncheck a toggle-button (checkbox/radio)

'locator' is an element locator
(define (selenium::uncheck sel-sess locator)
            (selenium::do-command sel-sess "uncheck" locator ))


selenium::select

Index
Select an option from a drop-down using an option locator.


Option locators provide different ways of specifying options of an HTML
Select element (e.g. for selecting a specific option, or for asserting
that the selected option satisfies a specification). There are several
forms of Select Option Locator.

label=labelPattern:
matches options based on their labels, i.e. the visible text. (This
is the default.)
label=regexp:^[Oo]ther
value=valuePattern:
matches options based on their values.
value=other
id=id:

matches options based on their ids.
id=option1
index=index:
matches an option based on its index (offset from zero).
index=2


If no option locator prefix is provided, the default behaviour is to match on label.



'selectLocator' is an element locator identifying a drop-down menu
'optionLocator' is an option locator (a label by default)
(define (selenium::select sel-sess selectLocator optionLocator)
            (selenium::do-command sel-sess "select" selectLocator optionLocator ))


selenium::add_selection

Index
Add a selection to the set of selected options in a multi-select element using an option locator.

@see #doSelect for details of option locators

'locator' is an element locator identifying a multi-select box
'optionLocator' is an option locator (a label by default)
(define (selenium::add_selection sel-sess locator optionLocator)
            (selenium::do-command sel-sess "addSelection" locator optionLocator ))


selenium::remove_selection

Index
Remove a selection from the set of selected options in a multi-select element using an option locator.

@see #doSelect for details of option locators

'locator' is an element locator identifying a multi-select box
'optionLocator' is an option locator (a label by default)
(define (selenium::remove_selection sel-sess locator optionLocator)
            (selenium::do-command sel-sess "removeSelection" locator optionLocator ))


selenium::remove_all_selections

Index
Unselects all of the selected options in a multi-select element.

'locator' is an element locator identifying a multi-select box
(define (selenium::remove_all_selections sel-sess locator)
            (selenium::do-command sel-sess "removeAllSelections" locator ))


selenium::submit

Index
Submit the specified form. This is particularly useful for forms without
submit buttons, e.g. single-input "Search" forms.

'formLocator' is an element locator for the form you want to submit
(define (selenium::submit sel-sess formLocator)
            (selenium::do-command sel-sess "submit" formLocator ))


selenium::open

Index
Opens an URL in the test frame. This accepts both relative and absolute
URLs.

The "open" command waits for the page to load before proceeding,
ie. the "AndWait" suffix is implicit.

Note: The URL must be on the same domain as the runner HTML
due to security restrictions in the browser (Same Origin Policy). If you
need to open an URL on another domain, use the Selenium Server to start a
new browser session on that domain.

'url' is the URL to open; may be relative or absolute
(define (selenium::open sel-sess url)
            (selenium::do-command sel-sess "open" url ))


selenium::open_window

Index
Opens a popup window (if a window with that ID isn't already open).
After opening the window, you'll need to select it using the selectWindow
command.

This command can also be a useful workaround for bug SEL-339.  In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
an empty (blank) url, like this: openWindow("", "myFunnyWindow").


'url' is the URL to open, which can be blank
'windowID' is the JavaScript window ID of the window to select
(define (selenium::open_window sel-sess url windowID)
            (selenium::do-command sel-sess "openWindow" url windowID ))


selenium::select_window

Index
Selects a popup window; once a popup window has been selected, all
commands go to that window. To select the main window again, use null
as the target.

Note that there is a big difference between a window's internal JavaScript "name" property
and the "title" of a given window's document (which is normally what you actually see, as an end user,
in the title bar of the window).  The "name" is normally invisible to the end-user; it's the second 
parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
(which selenium intercepts).
Selenium has several strategies for finding the window object referred to by the "windowID" parameter.
1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
that this variable contains the return value from a call to the JavaScript window.open() method.
3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title".
Since "title" is not necessarily unique, this may have unexpected behavior.
If you're having trouble figuring out what is the name of a window that you want to manipulate, look at the selenium log messages
which identify the names of windows created via window.open (and therefore intercepted by selenium).  You will see messages
like the following for each window as it is opened:
debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"
In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
(This is bug SEL-339.)  In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
an empty (blank) url, like this: openWindow("", "myFunnyWindow").


'windowID' is the JavaScript window ID of the window to select
(define (selenium::select_window sel-sess windowID)
            (selenium::do-command sel-sess "selectWindow" windowID ))


selenium::select_frame

Index
Selects a frame within the current window.  (You may invoke this command
multiple times to select nested frames.)  To select the parent frame, use
"relative=parent" as a locator; to select the top frame, use "relative=top".
You can also select a frame by its 0-based index number; select the first frame with
"index=0", or the third frame with "index=2".

You may also use a DOM expression to identify the frame you want directly,
like this: dom=frames["main"].frames["subframe"]


'locator' is an element locator identifying a frame or iframe
(define (selenium::select_frame sel-sess locator)
            (selenium::do-command sel-sess "selectFrame" locator ))


selenium::get_whether_this_frame_match_frame_expression

Index
Determine whether current/locator identify the frame containing this running code.

This is useful in proxy injection mode, where this code runs in every
browser frame and window, and sometimes the selenium server needs to identify
the "current" frame.  In this case, when the test calls selectFrame, this
routine is called for each frame to figure out which one has been selected.
The selected frame will return true, while all others will return false.


'currentFrameString' is starting frame
'target' is new frame (which might be relative to the current one)
(define (selenium::get_whether_this_frame_match_frame_expression sel-sess currentFrameString target)
            (selenium::get-boolean sel-sess "getWhetherThisFrameMatchFrameExpression" currentFrameString target ))


selenium::get_whether_this_window_match_window_expression

Index
Determine whether currentWindowString plus target identify the window containing this running code.

This is useful in proxy injection mode, where this code runs in every
browser frame and window, and sometimes the selenium server needs to identify
the "current" window.  In this case, when the test calls selectWindow, this
routine is called for each window to figure out which one has been selected.
The selected window will return true, while all others will return false.


'currentWindowString' is starting window
'target' is new window (which might be relative to the current one, e.g., "_parent")
(define (selenium::get_whether_this_window_match_window_expression sel-sess currentWindowString target)
            (selenium::get-boolean sel-sess "getWhetherThisWindowMatchWindowExpression" currentWindowString target ))


selenium::wait_for_pop_up

Index
Waits for a popup window to appear and load up.

'windowID' is the JavaScript window ID of the window that will appear
'timeout' is a timeout in milliseconds, after which the action will return with an error
(define (selenium::wait_for_pop_up sel-sess windowID timeout)
            (selenium::do-command sel-sess "waitForPopUp" windowID timeout ))


selenium::choose_cancel_on_next_confirmation

Index
By default, Selenium's overridden window.confirm() function will
return true, as if the user had manually clicked OK; after running
this command, the next call to confirm() will return false, as if
the user had clicked Cancel.  Selenium will then resume using the
default behavior for future confirmations, automatically returning 
true (OK) unless/until you explicitly call this command for each
confirmation.

(define (selenium::choose_cancel_on_next_confirmation sel-sess )
            (selenium::do-command sel-sess "chooseCancelOnNextConfirmation" ))


selenium::choose_ok_on_next_confirmation

Index
Undo the effect of calling chooseCancelOnNextConfirmation.  Note
that Selenium's overridden window.confirm() function will normally automatically
return true, as if the user had manually clicked OK, so you shouldn't
need to use this command unless for some reason you need to change
your mind prior to the next confirmation.  After any confirmation, Selenium will resume using the
default behavior for future confirmations, automatically returning 
true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
confirmation.

(define (selenium::choose_ok_on_next_confirmation sel-sess )
            (selenium::do-command sel-sess "chooseOkOnNextConfirmation" ))


selenium::answer_on_next_prompt

Index
Instructs Selenium to return the specified answer string in response to
the next JavaScript prompt [window.prompt()].

'answer' is the answer to give in response to the prompt pop-up
(define (selenium::answer_on_next_prompt sel-sess answer)
            (selenium::do-command sel-sess "answerOnNextPrompt" answer ))


selenium::go_back

Index
Simulates the user clicking the "back" button on their browser.

(define (selenium::go_back sel-sess )
            (selenium::do-command sel-sess "goBack" ))


selenium::refresh

Index
Simulates the user clicking the "Refresh" button on their browser.

(define (selenium::refresh sel-sess )
            (selenium::do-command sel-sess "refresh" ))


selenium::close

Index
Simulates the user clicking the "close" button in the titlebar of a popup
window or tab.

(define (selenium::close sel-sess )
            (selenium::do-command sel-sess "close" ))


selenium::is_alert_present

Index
Has an alert occurred?


This function never throws an exception



(define (selenium::is_alert_present sel-sess )
            (selenium::get-boolean sel-sess "isAlertPresent" ))


selenium::is_prompt_present

Index
Has a prompt occurred?


This function never throws an exception



(define (selenium::is_prompt_present sel-sess )
            (selenium::get-boolean sel-sess "isPromptPresent" ))


selenium::is_confirmation_present

Index
Has confirm() been called?


This function never throws an exception



(define (selenium::is_confirmation_present sel-sess )
            (selenium::get-boolean sel-sess "isConfirmationPresent" ))


selenium::get_alert

Index
Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.

Getting an alert has the same effect as manually clicking OK. If an
alert is generated but you do not get/verify it, the next Selenium action
will fail.
NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
dialog.
NOTE: Selenium does NOT support JavaScript alerts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.


(define (selenium::get_alert sel-sess )
            (selenium::get-string sel-sess "getAlert" ))


selenium::get_confirmation

Index
Retrieves the message of a JavaScript confirmation dialog generated during
the previous action.


By default, the confirm function will return true, having the same effect
as manually clicking OK. This can be changed by prior execution of the
chooseCancelOnNextConfirmation command. If an confirmation is generated
but you do not get/verify it, the next Selenium action will fail.


NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
dialog.


NOTE: Selenium does NOT support JavaScript confirmations that are
generated in a page's onload() event handler. In this case a visible
dialog WILL be generated and Selenium will hang until you manually click
OK.



(define (selenium::get_confirmation sel-sess )
            (selenium::get-string sel-sess "getConfirmation" ))


selenium::get_prompt

Index
Retrieves the message of a JavaScript question prompt dialog generated during
the previous action.

Successful handling of the prompt requires prior execution of the
answerOnNextPrompt command. If a prompt is generated but you
do not get/verify it, the next Selenium action will fail.
NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
dialog.
NOTE: Selenium does NOT support JavaScript prompts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.


(define (selenium::get_prompt sel-sess )
            (selenium::get-string sel-sess "getPrompt" ))


selenium::get_location

Index
Gets the absolute URL of the current page.

(define (selenium::get_location sel-sess )
            (selenium::get-string sel-sess "getLocation" ))


selenium::get_title

Index
Gets the title of the current page.

(define (selenium::get_title sel-sess )
            (selenium::get-string sel-sess "getTitle" ))


selenium::get_body_text

Index
Gets the entire text of the page.

(define (selenium::get_body_text sel-sess )
            (selenium::get-string sel-sess "getBodyText" ))


selenium::get_value

Index
Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
For checkbox/radio elements, the value will be "on" or "off" depending on
whether the element is checked or not.

'locator' is an element locator
(define (selenium::get_value sel-sess locator)
            (selenium::get-string sel-sess "getValue" locator ))


selenium::get_text

Index
Gets the text of an element. This works for any element that contains
text. This command uses either the textContent (Mozilla-like browsers) or
the innerText (IE-like browsers) of the element, which is the rendered
text shown to the user.

'locator' is an element locator
(define (selenium::get_text sel-sess locator)
            (selenium::get-string sel-sess "getText" locator ))


selenium::highlight

Index
Briefly changes the backgroundColor of the specified element yellow.  Useful for debugging.

'locator' is an element locator
(define (selenium::highlight sel-sess locator)
            (selenium::do-command sel-sess "highlight" locator ))


selenium::get_eval

Index
Gets the result of evaluating the specified JavaScript snippet.  The snippet may
have multiple lines, but only the result of the last line will be returned.

Note that, by default, the snippet will run in the context of the "selenium"
object itself, so this will refer to the Selenium object.  Use window to
refer to the window of your application, e.g. window.document.getElementById('foo')
If you need to use
a locator to refer to a single element in your application page, you can
use this.browserbot.findElement("id=foo") where "id=foo" is your locator.


'script' is the JavaScript snippet to run
(define (selenium::get_eval sel-sess script)
            (selenium::get-string sel-sess "getEval" script ))


selenium::is_checked

Index
Gets whether a toggle-button (checkbox/radio) is checked.  Fails if the specified element doesn't exist or isn't a toggle-button.

'locator' is an element locator pointing to a checkbox or radio button
(define (selenium::is_checked sel-sess locator)
            (selenium::get-boolean sel-sess "isChecked" locator ))


selenium::get_table

Index
Gets the text from a cell of a table. The cellAddress syntax
tableLocator.row.column, where row and column start at 0.

'tableCellAddress' is a cell address, e.g. "foo.1.4"
(define (selenium::get_table sel-sess tableCellAddress)
            (selenium::get-string sel-sess "getTable" tableCellAddress ))


selenium::get_selected_labels

Index
Gets all option labels (visible text) for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_labels sel-sess selectLocator)
            (selenium::get-string-array sel-sess "getSelectedLabels" selectLocator ))


selenium::get_selected_label

Index
Gets option label (visible text) for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_label sel-sess selectLocator)
            (selenium::get-string sel-sess "getSelectedLabel" selectLocator ))


selenium::get_selected_values

Index
Gets all option values (value attributes) for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_values sel-sess selectLocator)
            (selenium::get-string-array sel-sess "getSelectedValues" selectLocator ))


selenium::get_selected_value

Index
Gets option value (value attribute) for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_value sel-sess selectLocator)
            (selenium::get-string sel-sess "getSelectedValue" selectLocator ))


selenium::get_selected_indexes

Index
Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_indexes sel-sess selectLocator)
            (selenium::get-string-array sel-sess "getSelectedIndexes" selectLocator ))


selenium::get_selected_index

Index
Gets option index (option number, starting at 0) for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_index sel-sess selectLocator)
            (selenium::get-string sel-sess "getSelectedIndex" selectLocator ))


selenium::get_selected_ids

Index
Gets all option element IDs for selected options in the specified select or multi-select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_ids sel-sess selectLocator)
            (selenium::get-string-array sel-sess "getSelectedIds" selectLocator ))


selenium::get_selected_id

Index
Gets option element ID for selected option in the specified select element.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_selected_id sel-sess selectLocator)
            (selenium::get-string sel-sess "getSelectedId" selectLocator ))


selenium::is_something_selected

Index
Determines whether some option in a drop-down menu is selected.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::is_something_selected sel-sess selectLocator)
            (selenium::get-boolean sel-sess "isSomethingSelected" selectLocator ))


selenium::get_select_options

Index
Gets all option labels in the specified select drop-down.

'selectLocator' is an element locator identifying a drop-down menu
(define (selenium::get_select_options sel-sess selectLocator)
            (selenium::get-string-array sel-sess "getSelectOptions" selectLocator ))


selenium::get_attribute

Index
Gets the value of an element attribute.

'attributeLocator' is an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
(define (selenium::get_attribute sel-sess attributeLocator)
            (selenium::get-string sel-sess "getAttribute" attributeLocator ))


selenium::is_text_present

Index
Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.

'pattern' is a pattern to match with the text of the page
(define (selenium::is_text_present sel-sess pattern)
            (selenium::get-boolean sel-sess "isTextPresent" pattern ))


selenium::is_element_present

Index
Verifies that the specified element is somewhere on the page.

'locator' is an element locator
(define (selenium::is_element_present sel-sess locator)
            (selenium::get-boolean sel-sess "isElementPresent" locator ))


selenium::is_visible

Index
Determines if the specified element is visible. An
element can be rendered invisible by setting the CSS "visibility"
property to "hidden", or the "display" property to "none", either for the
element itself or one if its ancestors.  This method will fail if
the element is not present.

'locator' is an element locator
(define (selenium::is_visible sel-sess locator)
            (selenium::get-boolean sel-sess "isVisible" locator ))


selenium::is_editable

Index
Determines whether the specified input element is editable, ie hasn't been disabled.
This method will fail if the specified element isn't an input element.

'locator' is an element locator
(define (selenium::is_editable sel-sess locator)
            (selenium::get-boolean sel-sess "isEditable" locator ))


selenium::get_all_buttons

Index
Returns the IDs of all buttons on the page.

If a given button has no ID, it will appear as "" in this array.


(define (selenium::get_all_buttons sel-sess )
            (selenium::get-string-array sel-sess "getAllButtons" ))


selenium::get_all_links

Index
Returns the IDs of all links on the page.

If a given link has no ID, it will appear as "" in this array.


(define (selenium::get_all_links sel-sess )
            (selenium::get-string-array sel-sess "getAllLinks" ))


selenium::get_all_fields

Index
Returns the IDs of all input fields on the page.

If a given field has no ID, it will appear as "" in this array.


(define (selenium::get_all_fields sel-sess )
            (selenium::get-string-array sel-sess "getAllFields" ))


selenium::get_attribute_from_all_windows

Index
Returns every instance of some attribute from all known windows.

'attributeName' is name of an attribute on the windows
(define (selenium::get_attribute_from_all_windows sel-sess attributeName)
            (selenium::get-string-array sel-sess "getAttributeFromAllWindows" attributeName ))


selenium::dragdrop

Index
deprecated - use dragAndDrop instead

'locator' is an element locator
'movementsString' is offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
(define (selenium::dragdrop sel-sess locator movementsString)
            (selenium::do-command sel-sess "dragdrop" locator movementsString ))


selenium::set_mouse_speed

Index
Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
Setting this value to 0 means that we'll send a "mousemove" event to every single pixel
in between the start location and the end location; that can be very slow, and may
cause some browsers to force the JavaScript to timeout.
If the mouse speed is greater than the distance between the two dragged objects, we'll
just send one "mousemove" at the start location and then one final one at the end location.


'pixels' is the number of pixels between "mousemove" events
(define (selenium::set_mouse_speed sel-sess pixels)
            (selenium::do-command sel-sess "setMouseSpeed" pixels ))


selenium::get_mouse_speed

Index
Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).

(define (selenium::get_mouse_speed sel-sess )
            (selenium::get-number sel-sess "getMouseSpeed" ))


selenium::drag_and_drop

Index
Drags an element a certain distance and then drops it

'locator' is an element locator
'movementsString' is offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
(define (selenium::drag_and_drop sel-sess locator movementsString)
            (selenium::do-command sel-sess "dragAndDrop" locator movementsString ))


selenium::drag_and_drop_to_object

Index
Drags an element and drops it on another element

'locatorOfObjectToBeDragged' is an element to be dragged
'locatorOfDragDestinationObject' is an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged  is dropped
(define (selenium::drag_and_drop_to_object sel-sess locatorOfObjectToBeDragged locatorOfDragDestinationObject)
            (selenium::do-command sel-sess "dragAndDropToObject" locatorOfObjectToBeDragged locatorOfDragDestinationObject ))


selenium::window_focus

Index
Gives focus to the currently selected window

(define (selenium::window_focus sel-sess )
            (selenium::do-command sel-sess "windowFocus" ))


selenium::window_maximize

Index
Resize currently selected window to take up the entire screen

(define (selenium::window_maximize sel-sess )
            (selenium::do-command sel-sess "windowMaximize" ))


selenium::get_all_window_ids

Index
Returns the IDs of all windows that the browser knows about.

(define (selenium::get_all_window_ids sel-sess )
            (selenium::get-string-array sel-sess "getAllWindowIds" ))


selenium::get_all_window_names

Index
Returns the names of all windows that the browser knows about.

(define (selenium::get_all_window_names sel-sess )
            (selenium::get-string-array sel-sess "getAllWindowNames" ))


selenium::get_all_window_titles

Index
Returns the titles of all windows that the browser knows about.

(define (selenium::get_all_window_titles sel-sess )
            (selenium::get-string-array sel-sess "getAllWindowTitles" ))


selenium::get_html_source

Index
Returns the entire HTML source between the opening and
closing "html" tags.

(define (selenium::get_html_source sel-sess )
            (selenium::get-string sel-sess "getHtmlSource" ))


selenium::set_cursor_position

Index
Moves the text cursor to the specified position in the given input element or textarea.
This method will fail if the specified element isn't an input element or textarea.

'locator' is an element locator pointing to an input element or textarea
'position' is the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field.  You can also set the cursor to -1 to move it to the end of the field.
(define (selenium::set_cursor_position sel-sess locator position)
            (selenium::do-command sel-sess "setCursorPosition" locator position ))


selenium::get_element_index

Index
Get the relative index of an element to its parent (starting from 0). The comment node and empty text node
will be ignored.

'locator' is an element locator pointing to an element
(define (selenium::get_element_index sel-sess locator)
            (selenium::get-number sel-sess "getElementIndex" locator ))


selenium::is_ordered

Index
Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will
not be considered ordered.

'locator1' is an element locator pointing to the first element
'locator2' is an element locator pointing to the second element
(define (selenium::is_ordered sel-sess locator1 locator2)
            (selenium::get-boolean sel-sess "isOrdered" locator1 locator2 ))


selenium::get_element_position_left

Index
Retrieves the horizontal position of an element

'locator' is an element locator pointing to an element OR an element itself
(define (selenium::get_element_position_left sel-sess locator)
            (selenium::get-number sel-sess "getElementPositionLeft" locator ))


selenium::get_element_position_top

Index
Retrieves the vertical position of an element

'locator' is an element locator pointing to an element OR an element itself
(define (selenium::get_element_position_top sel-sess locator)
            (selenium::get-number sel-sess "getElementPositionTop" locator ))


selenium::get_element_width

Index
Retrieves the width of an element

'locator' is an element locator pointing to an element
(define (selenium::get_element_width sel-sess locator)
            (selenium::get-number sel-sess "getElementWidth" locator ))


selenium::get_element_height

Index
Retrieves the height of an element

'locator' is an element locator pointing to an element
(define (selenium::get_element_height sel-sess locator)
            (selenium::get-number sel-sess "getElementHeight" locator ))


selenium::get_cursor_position

Index
Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.

Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to
return the position of the last location of the cursor, even though the cursor is now gone from the page.  This is filed as SEL-243.

This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.

'locator' is an element locator pointing to an input element or textarea
(define (selenium::get_cursor_position sel-sess locator)
            (selenium::get-number sel-sess "getCursorPosition" locator ))


selenium::get_expression

Index
Returns the specified expression.

This is useful because of JavaScript preprocessing.
It is used to generate commands like assertExpression and waitForExpression.


'expression' is the value to return
(define (selenium::get_expression sel-sess expression)
            (selenium::get-string sel-sess "getExpression" expression ))


selenium::get_xpath_count

Index
Returns the number of nodes that match the specified xpath, eg. "//table" would give
the number of tables.

'xpath' is the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.
(define (selenium::get_xpath_count sel-sess xpath)
            (selenium::get-number sel-sess "getXpathCount" xpath ))


selenium::assign_id

Index
Temporarily sets the "id" attribute of the specified element, so you can locate it in the future
using its ID rather than a slow/complicated XPath.  This ID will disappear once the page is
reloaded.

'locator' is an element locator pointing to an element
'identifier' is a string to be used as the ID of the specified element
(define (selenium::assign_id sel-sess locator identifier)
            (selenium::do-command sel-sess "assignId" locator identifier ))


selenium::allow_native_xpath

Index
Specifies whether Selenium should use the native in-browser implementation
of XPath (if any native version is available); if you pass "false" to
this function, we will always use our pure-JavaScript xpath library.
Using the pure-JS xpath library can improve the consistency of xpath
element locators between different browser vendors, but the pure-JS
version is much slower than the native implementations.

'allow' is boolean, true means we'll prefer to use native XPath; false means we'll only use JS XPath
(define (selenium::allow_native_xpath sel-sess allow)
            (selenium::do-command sel-sess "allowNativeXpath" allow ))


selenium::wait_for_condition

Index
Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
The snippet may have multiple lines, but only the result of the last line
will be considered.

Note that, by default, the snippet will be run in the runner's test window, not in the window
of your application.  To get the window of your application, you can use
the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then
run your JavaScript in there


'script' is the JavaScript snippet to run
'timeout' is a timeout in milliseconds, after which this command will return with an error
(define (selenium::wait_for_condition sel-sess script timeout)
            (selenium::do-command sel-sess "waitForCondition" script timeout ))


selenium::set_timeout

Index
Specifies the amount of time that Selenium will wait for actions to complete.

Actions that require waiting include "open" and the "waitFor*" actions.

The default timeout is 30 seconds.

'timeout' is a timeout in milliseconds, after which the action will return with an error
(define (selenium::set_timeout sel-sess timeout)
            (selenium::do-command sel-sess "setTimeout" timeout ))


selenium::wait_for_page_to_load

Index
Waits for a new page to load.

You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc.
(which are only available in the JS API).
Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded"
flag when it first notices a page load.  Running any other Selenium command after
turns the flag to false.  Hence, if you want to wait for a page to load, you must
wait immediately after a Selenium command that caused a page-load.


'timeout' is a timeout in milliseconds, after which this command will return with an error
(define (selenium::wait_for_page_to_load sel-sess timeout)
            (selenium::do-command sel-sess "waitForPageToLoad" timeout ))


selenium::wait_for_frame_to_load

Index
Waits for a new frame to load.

Selenium constantly keeps track of new pages and frames loading, 
and sets a "newPageLoaded" flag when it first notices a page load.


See waitForPageToLoad for more information.

'frameAddress' is FrameAddress from the server side
'timeout' is a timeout in milliseconds, after which this command will return with an error
(define (selenium::wait_for_frame_to_load sel-sess frameAddress timeout)
            (selenium::do-command sel-sess "waitForFrameToLoad" frameAddress timeout ))


selenium::get_cookie

Index
Return all cookies of the current page under test.

(define (selenium::get_cookie sel-sess )
            (selenium::get-string sel-sess "getCookie" ))


selenium::create_cookie

Index
Create a new cookie whose path and domain are same with those of current page
under test, unless you specified a path for this cookie explicitly.

'nameValuePair' is name and value of the cookie in a format "name=value"
'optionsString' is options for the cookie. Currently supported options include 'path' and 'max_age'.      the optionsString's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit      of the value of 'max_age' is second.
(define (selenium::create_cookie sel-sess nameValuePair optionsString)
            (selenium::do-command sel-sess "createCookie" nameValuePair optionsString ))


selenium::delete_cookie

Index
Delete a named cookie with specified path.

'name' is the name of the cookie to be deleted
'path' is the path property of the cookie to be deleted
(define (selenium::delete_cookie sel-sess name path)
            (selenium::do-command sel-sess "deleteCookie" name path ))


selenium::set_browser_log_level

Index
Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded.
Valid logLevel strings are: "debug", "info", "warn", "error" or "off".
To see the browser logs, you need to
either show the log window in GUI mode, or enable browser-side logging in Selenium RC.

'logLevel' is one of the following: "debug", "info", "warn", "error" or "off"
(define (selenium::set_browser_log_level sel-sess logLevel)
            (selenium::do-command sel-sess "setBrowserLogLevel" logLevel ))


selenium::run_script

Index
Creates a new "script" tag in the body of the current test window, and 
adds the specified text into the body of the command.  Scripts run in
this way can often be debugged more easily than scripts executed using
Selenium's "getEval" command.  Beware that JS exceptions thrown in these script
tags aren't managed by Selenium, so you should probably wrap your script
in try/catch blocks if there is any chance that the script will throw
an exception.

'script' is the JavaScript snippet to run
(define (selenium::run_script sel-sess script)
            (selenium::do-command sel-sess "runScript" script ))


selenium::add_location_strategy

Index
Defines a new function for Selenium to locate elements on the page.
For example,
if you define the strategy "foo", and someone runs click("foo=blah"), we'll
run your function, passing you the string "blah", and click on the element 
that your function
returns, or throw an "Element not found" error if your function returns null.

We'll pass three arguments to your function:
locator: the string the user passed ininWindow: the currently selected windowinDocument: the currently selected document

The function must return null if the element can't be found.

'strategyName' is the name of the strategy to define; this should use only   letters [a-zA-Z] with no spaces or other punctuation.
'functionDefinition' is a string defining the body of a function in JavaScript.   For example: return inDocument.getElementById(locator);
(define (selenium::add_location_strategy sel-sess strategyName functionDefinition)
            (selenium::do-command sel-sess "addLocationStrategy" strategyName functionDefinition ))


selenium::set_context

Index
Writes a message to the status bar and adds a note to the browser-side
log.

'context' is the message to be sent to the browser
(define (selenium::set_context sel-sess context)
            (selenium::do-command sel-sess "setContext" context ))


selenium::capture_screenshot

Index
Captures a PNG screenshot to the specified file.

'filename' is the absolute path to the file to be written, e.g. "c:\blah\screenshot.png"
(define (selenium::capture_screenshot sel-sess filename)
            (selenium::do-command sel-sess "captureScreenshot" filename ))