Module: OperaWatir::DesktopContainer

Included in:
DesktopBrowser, QuickWidget, QuickWindow
Defined in:
lib/operawatir/desktop_container.rb

Instance Method Summary collapse

Instance Method Details

#quick_addressfield(how, what) ⇒ Object

Method for accessing an addressfield object

Examples:

browser.quick_toolbar(:name, "Document Toolbar").quick_addressfield(:name, "tba_addressfield")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    addressfield object if found, otherwise nil



195
196
197
# File 'lib/operawatir/desktop_container.rb', line 195

def quick_addressfield(how, what)
    QuickAddressField.new(self, how, what, parent_widget, window_id, :addressfield)
end

#quick_button(how, what) ⇒ Object

Method for accessing a button element

Examples:

browser.quick_button(:name, "button_OK")

Parameters:

  • how (String)

    Method to find the element. :name, :text or :string_id of the button

  • what (String)

    Search text to find the element with. Currently name, text or string_id of the button

Returns:

  • (Object)

    button object if found, otherwise nil



16
17
18
19
20
21
22
23
24
# File 'lib/operawatir/desktop_container.rb', line 16

def quick_button(how, what)
  what = [0, what] if how == :pos && (what.is_a? Fixnum)
  #if how == :pos
  #  if what.is_a? Fixnum
  #    what = [0, what]
  #  end
  #end
  QuickButton.new(self, how, what, parent_widget, window_id, :button)
end

#quick_checkbox(how, what) ⇒ Object

Method for accessing a checkbox element

Examples:

browser.quick_checkbox(:name, "Enable_wand_checkbox")

Parameters:

  • how (String)

    Method to find the element. :name, :text or :string_id

  • what (String)

    Search text to find element with.

Returns:

  • (Object)

    checkbox object if found, otherwise nil



59
60
61
# File 'lib/operawatir/desktop_container.rb', line 59

def quick_checkbox(how, what)
  QuickCheckbox.new(self, how, what, parent_widget, window_id, :checkbox)
end

#quick_dialogtab(how, what) ⇒ Object

Method for accessing a tab on a tabbed dialog

Examples:

browser.quick_dialogtab(:name, "tab_prefs_forms")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    dialog tab object if found, otherwise nil



74
75
76
# File 'lib/operawatir/desktop_container.rb', line 74

def quick_dialogtab(how, what)
  QuickDialogTab.new(self, how, what, parent_widget, window_id, :dialogtab)
end

#quick_dropdown(how, what) ⇒ Object

Method for accessing a combobox (i.e. dropdown) element

Examples:

browser.quick_dropdown(:name, "Startup_mode_dropdown")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    drop down object if found, otherwise nil



89
90
91
# File 'lib/operawatir/desktop_container.rb', line 89

def quick_dropdown(how, what)
  QuickDropdown.new(self, how, what, parent_widget, window_id, :dropdown)
end

#quick_dropdownitem(how, what) ⇒ Object

Method for accessing a combobox (i.e. dropdown) element

Examples:

browser.quick_dropdown(:name, "Startup_mode_dropdown")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    drop down object if found, otherwise nil



104
105
106
# File 'lib/operawatir/desktop_container.rb', line 104

def quick_dropdownitem(how, what)
  QuickDropdownItem.new(self, how, what, parent_widget, window_id, :dropdownitem)
end

#quick_editfield(how, what) ⇒ Object

Method for accessing an edit or multiedit element

Examples:

browser.quick_editfield(:name, "Startpage_edit")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    edit field object if found, otherwise nil



135
136
137
# File 'lib/operawatir/desktop_container.rb', line 135

def quick_editfield(how, what)
  QuickEditField.new(self, how, what, parent_widget, window_id, :editfield)
end

#quick_find(how, what) ⇒ Object

Method for accessing a quickfind element

Examples:

browser.quick_find(:name, "Filetypes_quickfind")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    quickfind object if found, otherwise nil



120
121
122
# File 'lib/operawatir/desktop_container.rb', line 120

def quick_find(how, what)
  QuickFind.new(self, how, what, parent_widget, window_id, :quickfind)
end

#quick_griditem(how, what) ⇒ Object

Method for accessing a grid item in a gridlayout

Examples:

(The label dialog for mail labels)

browser.quick_gridlayout(:name, "RulesGrid").quick_griditem(:name, "GridItem0").quick_editfield(:name, "Match")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with. Text or position of treeitem. Position is specified as [row, column]

Returns:

  • (Object)

    griditem object if found, otherwise nil



257
258
259
# File 'lib/operawatir/desktop_container.rb', line 257

def quick_griditem(how, what)
  QuickGridItem.new(self, how, what, parent_widget, window_id, :griditem)
end

#quick_gridlayout(how, what) ⇒ Object

Method for accessing a grid layout (A grid layout would normally be used to specify the path to a child item in one of its cells.

Examples:

(The label dialog for mail labels)

browser.quick_gridlayout(:name, "RulesGrid").quick_griditem(:name, "GridItem0").quick_editfield(:name, "Match")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with. Text or position of treeitem. Position is specified as [row, column]

Returns:

  • (Object)

    gridlayout object if found, otherwise nil



274
275
276
# File 'lib/operawatir/desktop_container.rb', line 274

def quick_gridlayout(how, what)
  QuickGridLayout.new(self, how, what, parent_widget, window_id, :gridlayout)
end

#quick_label(how, what) ⇒ Object

Method for accessing a label element

Examples:

browser.quick_label(:name, "label_for_Popups_dropdown")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    label object if found, otherwise nil



150
151
152
# File 'lib/operawatir/desktop_container.rb', line 150

def quick_label(how, what)
  QuickLabel.new(self, how, what, parent_widget, window_id, :label)
end

#quick_menu(how, what) ⇒ Object

Method for accessing a menu

Examples:

browser.quick_menu(:name, "Main Menu")

Parameters:

  • how (String)

    Method to find the element. Supported: :name

  • what (String)

    Search text to find the element with.



329
330
331
332
333
334
335
# File 'lib/operawatir/desktop_container.rb', line 329

def quick_menu(how, what)
  if mac_internal?
    QuickMenu.new(self, how, what, nil)
  else
    QuickMenu.new(self, how, what, window_id)
  end
end

#quick_menuitem(how, what) ⇒ Object

Method for accessing a menuitem

An acckey and pos are unique only within a given menu, so in this case
the accesspath to specify the item should include the menu

Note that only methods that identify a unique item gives a predictable result

Examples:

browser.quick_menu(:name, "Main Menu").quick_menuitem(:submenu, "Browser Tools Menu")
browser.quick_menuitem(:name, "Browser File Menu")
browser.quick_menuitem(:action, "Open page")
browser.quick_menuitem(:name, "Open link, vg.no")
browser.quick_menuitem(:string_id, "SOME_STRING_ID")
browser.quick_menu(:name, "Main Menu").quick_menuitem(:acckey, "b")
browser.quick_menu(:name, "Edit Item Popup Menu").quick_menuitem(:pos, 2)

Parameters:

  • how (String)

    Method to find the element. Supported: name, text, string_id, action submenu, pos, acckey, shortcut. The item name is:

    • if the item has an action, the action

    • if the item has an action with a parameter; “<action>, <actionparameter>”

    • else if the item opens a submenu, the submenuname

  • what (String)

    Search text to find element with



364
365
366
367
368
369
370
# File 'lib/operawatir/desktop_container.rb', line 364

def quick_menuitem(how, what)
  if mac_internal? || (window_id != nil && window_id <= 0)
      QuickMenuItem.new(self, how, what, name == 'Opera' ? nil : name)
  else
    QuickMenuItem.new(self, how, what, window_id)
  end
end

#quick_radiobutton(how, what) ⇒ Object

Method for accessing a radio button element

Examples:

browser.quick_radiobutton(:name, "Accept_cookies_radio")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    radio button object if found, otherwise nil



165
166
167
# File 'lib/operawatir/desktop_container.rb', line 165

def quick_radiobutton(how, what)
  QuickRadioButton.new(self, how, what, parent_widget, window_id, :radiobutton)
end

#quick_searchfield(how, what) ⇒ Object

Method for accessing a searchfield element

Examples:

browser.quick_searchfield(:name, "Web_search_searchfield")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    searchfield object if found, otherwise nil



210
211
212
# File 'lib/operawatir/desktop_container.rb', line 210

def quick_searchfield(how, what)
  QuickSearchField.new(self, how, what, parent_widget, window_id, :search)
end

#quick_tab(how, what) ⇒ Object

Method for accessing a tab button element

Examples:

browser.quick_window(:name, "Browser Window").quick_toolbar(:name, "Pagebar").quick_tab(:pos, 1)
browser.quick_window(:name, "Browser Window").quick_toolbar(:name, "Pagebar").quick_tab(:text, "Connect to Debugger")

Parameters:

  • how (String)

    Method to find the element. :text and :pos is supported.

  • what (String, FixNum)

    Search text or position to find the element with. Currently text or position of the tab button, first tab button has position 0.

Returns:

  • (Object)

    tab button object if found, otherwise nil



39
40
41
42
43
44
45
46
# File 'lib/operawatir/desktop_container.rb', line 39

def quick_tab(how, what)
  if how == :pos
    if what.is_a? Fixnum
      what = [0, what]
    end
  end
  QuickTab.new(self, how, what, parent_widget, window_id, :tabbutton)
end

#quick_thumbnail(how, what) ⇒ Object

Method for accessing a thumbnail (speeddial, thumbnail when hovering tab groups)

Examples:

browser.quick_thumbnail(:name, "Thumbnail 1")
browser.quick_thumbnail(:name, "Speed Dial 2")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with. Text or position of treeitem. Position is specified as [row, column]

Returns:

  • (Object)

    thumbnail object if found, otherwise nil



292
293
294
295
296
297
298
299
# File 'lib/operawatir/desktop_container.rb', line 292

def quick_thumbnail(how, what)
  if how == :pos
     if what.is_a? Fixnum
       what = [0, what]
     end
   end
  QuickThumbnail.new(self, how, what, parent_widget, window_id, :thumbnail)
end

#quick_toolbar(how, what) ⇒ Object

Method for accessing a toolbar element

Examples:

browser.quick_toolbar(:name, "Document_toolbar")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    toolbar object if found, otherwise nil



225
226
227
# File 'lib/operawatir/desktop_container.rb', line 225

def quick_toolbar(how, what)
  QuickToolbar.new(self, how, what, parent_widget, window_id, :toolbar)
end

#quick_treeitem(how, what) ⇒ Object

Method for accessing a tree item in a treeview

Examples:

browser.quick_treeview(:name, "Server_treeview").quick_treeitem(:pos, [2,0])

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with. Text or position of treeitem. Position is specified as [row, column]

Returns:

  • (Object)

    treeitem object if found, otherwise nil



241
242
243
# File 'lib/operawatir/desktop_container.rb', line 241

def quick_treeitem(how, what)
  QuickTreeItem.new(self, how, what, parent_widget, window_id, :treeitem)
end

#quick_treeview(how, what) ⇒ Object

Method for accessing a tree view element

Examples:

browser.quick_treeview(:name, "Web_search_treeview")

Parameters:

  • how (String)

    Method to find the element. :name, :string_id or :text

  • what (String)

    Search text to find the element with.

Returns:

  • (Object)

    treeview object if found, otherwise nil



180
181
182
# File 'lib/operawatir/desktop_container.rb', line 180

def quick_treeview(how, what)
  QuickTreeView.new(self, how, what, parent_widget, window_id, :treeview)
end

#quick_window(how, what) ⇒ Object

Method for accessing a window

Examples:

browser.quick_window(:name, "Browser Window")
browser.quick_window(:name, "Document Window")
browser.quick_window(:name, "Cycler Window")

Parameters:

  • how (String)

    Method to find the element. Currently only :name is supported

  • what (String)

    or [int] window_id Search text to find the element with. Name of window or the windows window_id

Returns:

  • (Object)

    window object if found, otherwise nil



316
317
318
# File 'lib/operawatir/desktop_container.rb', line 316

def quick_window(how, what)
  QuickWindow.new(self, how, what)
end