Class: OperaWatir::QuickTreeItem

Inherits:
QuickWidget show all
Defined in:
lib/operawatir/quickwidgets/quick_treeitem.rb

Constant Summary

Constants inherited from QuickWidget

OperaWatir::QuickWidget::ConditionTimeout

Instance Method Summary collapse

Methods inherited from QuickWidget

#click_with_condition, #double_click_with_condition, #enabled?, #exist?, #focus_with_hover, #has_ui_string?, #height, #middle_click_with_condition, #name, #open_menu_with_rightclick, #open_window_with_hover, #parent_name, #position, #quick_tabs, #quick_widgets, #right_click_with_condition, #text, #to_s, #type, #value, #verify_includes_text, #verify_text, #visible?, #widget_info_string, #width

Methods included from DesktopContainer

#quick_addressfield, #quick_button, #quick_checkbox, #quick_dialogtab, #quick_dropdown, #quick_dropdownitem, #quick_editfield, #quick_find, #quick_griditem, #quick_gridlayout, #quick_label, #quick_menu, #quick_menuitem, #quick_radiobutton, #quick_searchfield, #quick_tab, #quick_thumbnail, #quick_toolbar, #quick_treeitem, #quick_treeview, #quick_window

Instance Method Details

#activate_tab_with_clickObject

Switches to the tree view tab by clicking on it (e.g. on the Advanced page of the preferences dialog)

Raises:



93
94
95
96
97
98
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 93

def activate_tab_with_click
  click

  # No event yet so just cheat and sleep
  sleep(0.1);
end

#expand_with_clickObject Also known as: collapse_with_click

Expands a tree item when it is clicked

Raises:



30
31
32
33
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 30

def expand_with_click
  # For now there is no difference to focusing
  focus_with_click
end

#expand_with_double_clickObject Also known as: collapse_with_double_click

Expands a tree item when it is double clicked

Raises:



43
44
45
46
47
48
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 43

def expand_with_double_click
  scroll_item_into_view unless visible?
  double_click
  # No event yet so just cheat and sleep
  sleep(0.1);
end

#focus_with_clickObject

Set focus to the tree item by clicking on it

Raises:



18
19
20
21
22
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 18

def focus_with_click
  # First scroll the item into view
  scroll_item_into_view unless visible?
  super
end

#key_press(key, *opts) ⇒ String

Note:

The edit field must have focus for this method to work

Note:

WARNING: This method will not wait for page load or window shown events. If you need to wait for these events do not use this method

Presses a key including modifiers

Examples:

browser.quick_treeview(:name, "Bookmarks View").quick_treeitem(:text, "Ask.com").key_press("Down")
browser.quick_treeview(:name, "Bookmarks View").quick_treeitem(:text, "Ask.com").key_press("Del")

Parameters:

  • key (String)

    key to press (e.g. “a” or “backspace”)

  • modifiers (Symbol)

    optional modifier(s) to hold down while pressing the key (e.g. :shift, :ctrl, :alt, :meta)

Returns:

  • (String)

    Text in the field after the keypress



69
70
71
72
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 69

def key_press(key, *opts)
  key_press_direct(key, *opts)
  sleep(0.1)
end

#load_window_with_double_click(win_name) ⇒ int

Double clicks the tree item, and waits for the window with window name win_name to be loaded with the url of the treeitem

Parameters:

  • win_name (String)

    name of the window that will be loaded (Pass a blank string for any window)

Returns:

  • (int)

    Window ID of the window shown or 0 if no window is shown

Raises:



146
147
148
149
150
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 146

def load_window_with_double_click(win_name)
  wait_start
  click(:left, 2)
  wait_for_window_loaded(win_name)
end

#open_window_with_click(win_name) ⇒ int Also known as: open_dialog_with_click

Clicks the tree item, and waits for the window with window name win_name to be shown

Parameters:

  • win_name (String)

    name of the window that will be opened (Pass a blank string for any window)

Returns:

  • (int)

    Window ID of the window shown or 0 if no window is shown

Raises:



129
130
131
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 129

def open_window_with_click(win_name)
  open_window_with_click_internal(win_name, 1)
end

#open_window_with_double_click(win_name) ⇒ int Also known as: open_dialog_with_double_click

Double clicks the tree item, and waits for the window with window name win_name to be shown

Parameters:

  • win_name (String)

    name of the window that will be opened (Pass a blank string for any window)

Returns:

  • (int)

    Window ID of the window shown or 0 if no window is shown

Raises:



111
112
113
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 111

def open_window_with_double_click(win_name)
  open_window_with_click_internal(win_name, 2)
end

#selected?Boolean

Checks if the treeitem is selected

Returns:

  • (Boolean)

    true if the item is selected

Raises:



81
82
83
# File 'lib/operawatir/quickwidgets/quick_treeitem.rb', line 81

def selected?
  element.isSelected
end