Class: OperaWatir::QuickWindow

Inherits:
Object
  • Object
show all
Includes:
DesktopContainer
Defined in:
lib/operawatir/quickwidgets/quick_window.rb

Instance Method Summary collapse

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

#active?Boolean

Returns true if window is active.

Returns:

  • (Boolean)

    true if window is active



34
35
36
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 34

def active?
  element.isActive()
end

#exist?Boolean Also known as: exists?

Checks whether a window exists or not

Returns:

  • (Boolean)

    true if the window exists otherwise false



23
24
25
26
27
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 23

def exist?
  !!element
  rescue Exceptions::UnknownObjectException
    false
end

#heightObject

Returns height of window.

Returns:

  • height of window



130
131
132
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 130

def height
  element.getRect().height
end

#nameString

Gets the name of the window

Returns:

  • (String)

    name of the window

Raises:



57
58
59
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 57

def name
  element.getName
end

#on_screen?bool

Returns true if window is on screen.

Returns:

  • (bool)

    true if window is on screen

Raises:



90
91
92
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 90

def on_screen?
  element.isOnScreen
end

#quick_widgetsObject

Note:

You can also retrieve only widgets of a given type, using for example

browser.quick_window(:name, "Document Window").quick_toolbars

TODO: common with widget

quick_widgets

Examples:

browser.quick_window(:name, "Document Window").quick_widgets

Returns:

  • array of widgets in this window



179
180
181
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 179

def quick_widgets
  widgets(window_id)
end

#titleString

Gets the title of the window

Returns:

  • (String)

    title of window

Raises:



68
69
70
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 68

def title
  element.getTitle
end

#to_sString

Gets a string representation of the window

Returns:

  • (String)

    representation of the window

Raises:



80
81
82
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 80

def to_s
  "#{type} #{name}, title=#{title}, id=#{id}, on_screen=#{on_screen?}, active=#{active?}"
end

#typeSymbol

Gets the type of a window

Returns:

  • (Symbol)

    type of the window

Raises:



45
46
47
48
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 45

def type
  return WINDOW_ENUM_MAP.invert[@elm.getType] unless @elm == nil
  return WINDOW_ENUM_MAP.invert[element.getType]
end

#widthObject

Returns width of window.

Returns:

  • width of window



122
123
124
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 122

def width
  element.getRect().width
end

#window_idint Also known as: id

Gets this windows window id

Returns:

  • (int)

    the windows window_id

Raises:



101
102
103
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 101

def window_id
  element.getWindowID
end

#window_info_stringObject

Returns a string of the internal information about the window. Used to discover the names of widgets and windows to use in the tests.

Raises:



150
151
152
153
154
155
156
157
158
159
# File 'lib/operawatir/quickwidgets/quick_window.rb', line 150

def window_info_string
  "    Name: " + name +
  "\n   Title: " + title +
  "\n  Active: " + active?.to_s +
  "\n      ID: " + id.to_s +
  "\n    Type: " + type.to_s +
  "\nOnScreen: " + on_screen?.to_s +
  "\n     Pos: x=" + element.getRect().x.to_s + ", y=" + element.getRect().y.to_s +
  "\n    Size: width=" + element.getRect().width.to_s + ", height=" + element.getRect().height.to_s + "\n"
end