Module Selenium::Client::Extensions
In: lib/selenium/client/extensions.rb

Convenience methods not explicitely part of the protocol

Methods

Public Instance methods

These for all Ajax request to finish (Only works if you are using prototype, the wait happens in the browser)

See davidvollbracht.com/2008/6/4/30-days-of-tech-day-3-waitforajax for more background.

Wait for all Prototype effects to be processed (the wait happens in the browser).

Credits to github.com/brynary/webrat/tree/master

Wait for an element to be present (the wait happens in the browser).

Wait for a field to get a specific value (the wait happens in the browser).

Wait for an element to NOT be present (the wait happens in the browser).

Wait for a field to not have a specific value (the wait happens in the browser).

Wait for some text to NOT be present (the wait happens in the browser).

See wait_for_text for usage details.

Wait for something to not be visible (the wait happens in the browser).

Wait for some text to be present (the wait is happening browser side).

wait_for_text will search for the given argument within the innerHTML of the current DOM. Note that this method treats a single string as a special case.

Parameters

wait_for_text accepts an optional hash of parameters:

  • :element - a selenium locator for an element limiting the search scope.
  • :timeout_in_seconds - duration in seconds after which we time out if text cannot be found.

Regular Expressions

In addition to plain strings, wait_for_text accepts regular expressions as the pattern specification.

Examples

The following are equivalent, and will match "some text" anywhere within the document:

  wait_for_text "some text"
  wait_for_text /some text/

This will match "some text" anywhere within the specified element:

  wait_for_text /some text/, :element => "container"

This will match "some text" only if it exactly matches the complete innerHTML of the specified element:

  wait_for_text "some text", :element => "container"

Wait for something to be visible (the wait happens in the browser).

[Validate]