Method: Selenium::Client::Idiomatic#go_back

Defined in:
lib/selenium/client/idiomatic.rb

#go_back(options = {}) ⇒ Object

Simulates the user clicking the “back” button on their browser. Using ‘options’ you can automatically wait for an event to happen after the click. e.g.

  • go_back :wait_for => :page # will wait for a new page to load

  • go_back :wait_for => :popup, :window => ‘a window id’ # will wait for a new popup window to appear. Also selects the popup window for you provide ‘:select => true`

  • go_back :wait_for => :ajax # will wait for all ajax requests to be completed using semantics of default javascript framework

  • go_back :wait_for => :ajax, :javascript_framework => :jquery # will wait for all ajax requests to be completed overriding default javascript framework

  • go_back :wait_for => :effects # will wait for all javascript effects to be rendered using semantics of default javascript framework

  • go_back :wait_for => :effects, :javascript_framework => :prototype # will wait for all javascript effects to be rendered overriding default javascript framework

  • go_back :wait_for => :element, :element => ‘new_element_id’ # will wait for an element to be present/appear

  • go_back :wait_for => :no_element, :element => ‘new_element_id’ # will wait for an element to be not be present/disappear

  • go_back :wait_for => :text, :text => ‘some text’ # will wait for some text to be present/appear

  • go_back “a_locator”, :wait_for => :text, :text => /A Regexp/ # will wait for some text to be present/appear

  • go_back :wait_for => :text, :element => ‘a_locator’, :text => ‘some text’ # will wait for the content of ‘a_locator’ to be ‘some text’

  • go_back :wait_for => :no_text, :text => ‘some text’ # will wait for the text to be not be present/disappear

  • go_back “a_locator”, :wait_for => :no_text, :text => /A Regexp/ # will wait for the text to be not be present/disappear

  • go_back :wait_for => :no_text, :element => ‘a_locator’, :text => ‘some text’ # will wait for the content of ‘a_locator’ to not be ‘some text’

  • go_back :wait_for => :condition, :javascript => ‘some expression’ # will wait for the javascript expression to be true

  • go_back :wait_for => :value, :element => ‘a_locator’, :value => ‘some value’ # will wait for the field value of ‘a_locator’ to be ‘some value’

  • go_back :wait_for => :visible, :element => ‘a_locator’ # will wait for element to be visible

  • go_back :wait_for => :not_visible, :element => ‘a_locator’ # will wait for element to not be visible

  • go_back :wait_for => :no_value, :element => ‘a_locator’, :value => ‘some value’ # will wait for the field value of ‘a_locator’ to not be ‘some value’

Using options you can also define an explicit timeout (:timeout_in_seconds key). Otherwise the default driver timeout is used.



349
350
351
352
# File 'lib/selenium/client/idiomatic.rb', line 349

def go_back(options={})
  remote_control_command "goBack"
  wait_for options
end