Lapis Lazuli:Cheatsheet

From Test Automation Wiki
Jump to: navigation, search

About this page

This is the Lapis Lazuli Cheat Sheet. Here there will be a list containing the most used examples of Lapis Lazuli.

=== Lapis Lazuli Cheat Sheet ===
Definitions
selector The values to search an element, e.g. a
element with class="blue"
collection Also known as an Array. This is a list of multiple values within 1 variable.
Finding / Waiting functions
browser.find() browser.multi_find() browser.find_all() browser.multi_find_all()
browser.wait() browser.multi_wait() browser.wait_all() browser.multi_wait_all()
Searching/Waiting for 1 element using 1 selector Searching/Waiting for 1 element using multiple selectors Return all results matching 1 selector or wait until at least 1 became present Return all results matching the multiple selectors or wait until at least 1 became present
Finding options
"id"
browser.find("elmId")
:element
browser.find(
  :div => {
    :class => 'elmClass'
  }
)
:like (long)
browser.find(
  :like => {
    :element => :input,
    :attribute => :name,
    :value => 'surname'
  }
)
:like (short)
browser.find(
  :like => [:div, 'customAttribute', 'value']
)
:pick
browser.find_all(
    :like => [:div, :class, 'foo'],
    :pick => :last
)
:filter_by
browser.find(
  :like => [:input, 'name', 'surname'],
  :filter_by => :present?
)
:context
form = browser.find(:div => {:id => 'login_form'})
inputs = browser.find(
  :input => {:name => 'username'},
  :context => form
)
:message
browser.find(
  :div => {:class => 'error-box'},
  :message => 'The error box was present, so an error occurred!'
)
Retrieved from "http://www.testautomation.info/index.php?title=Lapis_Lazuli:Cheatsheet&oldid=163"