Class: OperaWatir::DesktopBrowser

Inherits:
Browser show all
Includes:
DesktopContainer
Defined in:
lib/operawatir/desktop_browser.rb

Constant Summary collapse

ConditionTimeout =
10.0
LoadActions =
["Open url in new page", "Open url in current page", "Open url in new background page",
"Open url in new window", "New private page", "Paste and go", "Paste and go background",
"Hotclick search", "Duplicate page", "Reopen page", "Back", "Forward", "Help", "Autocomplete server name"]

Instance Attribute Summary

Attributes inherited from Browser

#active_window, #keys, #preferences, #spatnav, #utils

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

Methods inherited from Browser

#actions, #copy, #cut, #key, #key_down, #key_up, #name, #opera_action, #opera_action_list, #paste, #platform, #quit, #select_all, settings, settings=, #type, #ua_string, #url=, #version

Instance Method Details

#action_with_condition(action_name, *params) ⇒ Object

action_with_condition { block } → res

Executes action and waits until block evaluates to true or timeout is hit.

Parameters:

  • action_name (String)
    • name of action to execute

  • *params
    • parameters to the action

Returns:

  • value of block, or false if no block provided



716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/operawatir/desktop_browser.rb', line 716

def action_with_condition(action_name, *params)
  return false unless block_given?

  opera_desktop_action(action_name, *params)

  start = Time.now
  until res = yield rescue false do
    if Time.now - start > ConditionTimeout
       return false
    end
    sleep 0.1
  end
  res
end

#activate_tab_with_key_press(key, *modifiers) ⇒ int

Clicks the key and modifiers and waits for a new tab to be activated

Examples:

browser.activate_tab_with_key_press("F6", :ctrl)

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:

  • (int)

    Window ID of the document window (tab) that is activated, or 0 if no tab is being activated



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

def activate_tab_with_key_press(key, *modifiers)
 wait_start
 # TODO: FIXME. key_down and up are not yet implemented on mac and windows
 if linux?
   key_down_direct(key,*modifiers)
   key_up_direct(key, *modifiers)
 else
   key_press_direct(key, *modifiers)
 end
 wait_for_window_activated("Document Window")
end

#active_quick_window_idObject

Get ID of active Desktop UI window



62
63
64
# File 'lib/operawatir/desktop_browser.rb', line 62

def active_quick_window_id
  driver.getActiveQuickWindowID()
end

#cache_preferences_pathString

Returns the full path to the Opera cache preferences folder

Returns:

  • (String)

    Full path to the cache preferences folder



550
551
552
# File 'lib/operawatir/desktop_browser.rb', line 550

def cache_preferences_path
  driver.getCachePreferencesPath()
end

#clear_all_private_dataint

Clear all private data (as in Delete Private Data Dialog)

Returns:

  • (int)

    0 if operation failed, else > 0



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/operawatir/desktop_browser.rb', line 599

def clear_all_private_data

  #FIXME: Set CheckFlags to uncheck to prevent storing the settings used here

  win_id = open_dialog_with_action("Clear Private Data Dialog", "Delete private data")
  return 0 if win_id == 0

  #Ensure is Expanded
  if quick_button(:name, "Destails_expand").value == 0
    quick_button(:name, "Destails_expand").toggle_with_click
  end

  quick_checkboxes("Clear Private Data Dialog").each do |box|
    box.toggle_with_click unless box.checked?
  end

  #Delete all
  win_id = quick_button(:name, "button_OK").close_dialog_with_click("Clear Private Data Dialog")

  #FIXME: Reset CheckFlags

  win_id
end

#clear_cacheObject

Clear disk cache



636
637
638
639
# File 'lib/operawatir/desktop_browser.rb', line 636

def clear_cache
  #TODO: Use Delete Private Data Dialog?
  opera_desktop_action("Clear disk cache")
end

#clear_historyObject

Clear typed and visited history



626
627
628
629
630
# File 'lib/operawatir/desktop_browser.rb', line 626

def clear_history
  #TODO: Use Delete Private Data Dialog?
  opera_desktop_action("Clear visited history")
  opera_desktop_action("Clear typed in history")
end

#close_active_menuObject

Closes the active menu



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/operawatir/desktop_browser.rb', line 382

def close_active_menu
  wait_start

  menus = quick_menus
  main = menus.select {|menu| menu.name == "Main Menu"}
  main_open = main.length > 0
  real_submenu = main_open ? (menus.length > 2) : menus.length > 1

  if real_submenu
    key_press_direct("Left")
  else
    close_menu
  end

  wait_for_menu_closed("")
end

#close_all_dialogsObject

Close all open dialogs



662
663
664
665
666
667
668
669
670
671
672
673
674
675
# File 'lib/operawatir/desktop_browser.rb', line 662

def close_all_dialogs
  win_id = driver.getActiveQuickWindowID()
  until quick_window(:id, win_id).type != :dialog do
    win = quick_window(:id, driver.getActiveQuickWindowID())
    if win.type == :dialog
      close_dialog(win.name)
      if (driver.getActiveQuickWindowID() != win_id)
        win_id = driver.getActiveQuickWindowID()
      else
        break
      end
    end
  end
end

#close_all_menusObject

Closes all open menus (Note: On mac one esc closes all menus)



403
404
405
406
407
408
409
410
# File 'lib/operawatir/desktop_browser.rb', line 403

def close_all_menus
  i = 6 #Just some number
  while quick_menus.delete_if { |menu| menu.name == "Main Menu" }.length > 0
     close_menu
     i-=1
     break if i == 0
  end
end

#close_all_tabsObject

Close all open tabs (except last one)



645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/operawatir/desktop_browser.rb', line 645

def close_all_tabs
  #The collection has the activate tab first and then the rest sorted on number, so resort to get on descending position
  quick_tabbuttons("Browser Window").sort {|t1, t2| (t2.position <=> t1.position) }.each do |btn|
    #Tab button is in Browser window which is prob not the active window,
    #so we cannot do this the easy way
    #btn.quick_button(:name, "pb_CloseButton").close_window_with_click("Document Window") unless btn.position == 0
    #puts "Current tab = #{btn}"
    if btn.position != 0 or btn.value > 1 then
      quick_window(:name, "Browser Window").quick_tab(:pos, btn.position).quick_button(:name, "pb_CloseButton").close_window_with_click("Document Window")
    end
  end
end

#close_dialog(dialog_name) ⇒ int

Close the dialog with name dialog_name, using the “Cancel” action

Examples:

browser.close_dialog("New Preferences Dialog")

Parameters:

  • dialog_name (String)

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

Returns:

  • (int)

    Window ID of the dialog closed or 0 if no window is closed



238
239
240
241
242
# File 'lib/operawatir/desktop_browser.rb', line 238

def close_dialog(dialog_name)
  wait_start
  opera_desktop_action("Cancel")
  wait_for_window_close(dialog_name)
end

#close_menu_with_key_press(menu_name, key, *modifiers) ⇒ String

Presses key and waits for the menu to close

Parameters:

  • menu_name (String)

    Name of the menu that should be opened

  • key (String)

    Key to press

Returns:

  • (String)

    name of menu that was closed, or empty string



490
491
492
493
494
# File 'lib/operawatir/desktop_browser.rb', line 490

def close_menu_with_key_press(menu_name, key, *modifiers)
  wait_start
  key_press_direct(key, *modifiers)
  wait_for_menu_closed(menu_name)
end

#close_window_with_action(win_name, action_name, *params) ⇒ int Also known as: close_dialog_with_action

Executes the action given by action_name, and waits for the window with window name win_name to close

Examples:

browser.close_window_with_action("New Preferences Dialog", "Cancel")
browser.close_window_with_action("New Preferences Dialog", "Cancel", "1")

Parameters:

  • win_name (String)

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

  • action_name (String)

    name of the action to execute to close the window

  • param (String)

    optional parameter(s) to be supplied with the Opera action.

Returns:

  • (int)

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



197
198
199
200
201
# File 'lib/operawatir/desktop_browser.rb', line 197

def close_window_with_action(win_name, action_name, *params)
  wait_start
  opera_desktop_action(action_name, *params)
  wait_for_window_close(win_name)
end

#close_window_with_key_press(win_name, key, *opts) ⇒ int Also known as: close_dialog_with_key_press

Presses the key, with optional modifiers, and waits for the window with window name win_name to close

Examples:

browser.close_window_with_key_press("New Preferences Dialog", "Esc")
browser.close_window_with_key_press("New Preferences Dialog", "w", :ctrl)

Parameters:

  • win_name (String)

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

  • 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:

  • (int)

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



219
220
221
222
223
# File 'lib/operawatir/desktop_browser.rb', line 219

def close_window_with_key_press(win_name, key, *opts)
  wait_start
  key_press_direct(key, *opts)
  wait_for_window_close(win_name)
end

#delete_profileObject

Deletes profile for the connected Opera instance. Should only be called after quitting (and before starting) Opera.



748
749
750
# File 'lib/operawatir/desktop_browser.rb', line 748

def delete_profile
  driver.deleteOperaPrefs
end

#desktop?Boolean

Is attached browser instance of type internal build or public desktop?

Returns:

  • (Boolean)

    True if browser attached is of type desktop, false otherwise.



793
794
795
# File 'lib/operawatir/desktop_browser.rb', line 793

def desktop?
  true # Not nice, but if you're running desktopbrowser, assume running desktop
end

#get_default_preference(prefs_section, pref) ⇒ String

Get default value of preference pref in prefs section prefs_section.

Parameters:

  • prefs_section (String)

    The prefs section the pref belongs to

  • pref (String)

    The preference to get

Returns:

  • (String)

    The value of the preference



779
780
781
# File 'lib/operawatir/desktop_browser.rb', line 779

def get_default_preference(prefs_section, pref)
  driver.getDefaultPref(prefs_section, pref)
end

#get_preference(prefs_section, pref) ⇒ String

Get value of preference pref in prefs section prefs_section.

Parameters:

  • prefs_section (String)

    The prefs section the pref belongs to

  • pref (String)

    The preference to get

Returns:

  • (String)

    The value of the preference



768
769
770
# File 'lib/operawatir/desktop_browser.rb', line 768

def get_preference(prefs_section, pref)
  driver.getPref(prefs_section, pref)
end

#key_press_with_condition(key, *modifiers) ⇒ Object

key_press_with_condition(key, modifiers) { block } → res

Performs the keypress specified and waits until block evaluates to true or timeout is hit

Parameters:

  • key (String)
    • key to press

  • *modifiers
    • modifier(s) to hold while pressing key

Returns:

  • value of block, or false if no block provided



689
690
691
692
693
694
695
696
697
698
699
700
701
702
# File 'lib/operawatir/desktop_browser.rb', line 689

def key_press_with_condition(key, *modifiers)
  return false unless block_given?

  key_press_direct(key, *modifiers)

  start = Time.now
  until res = yield rescue false do
    if Time.now - start > ConditionTimeout
      return false
    end
    sleep 0.1
  end
  res
end

#large_preferences_pathString

Returns the full path to the Opera large preferences folder

Returns:

  • (String)

    Full path to the large preferences folder



532
533
534
# File 'lib/operawatir/desktop_browser.rb', line 532

def large_preferences_path
  driver.getLargePreferencesPath()
end

#linux?Boolean

Returns true if the test is running on Linux

Returns:

  • (Boolean)

    true we the operating system is Linux, otherwise false



586
587
588
# File 'lib/operawatir/desktop_browser.rb', line 586

def linux?
 linux_internal?
end

#load_page_with_key_press(key, *modifiers) ⇒ int

Presses the key, with optional modifiers, and waits for loaded event

Examples:

browser.quick_toolbar(:name, "Document Toolbar").quick_addressfield(:name, "tba_address_field").\n
                       type_text(text_to_type).should == text_to_type
browser.load_page_with_key_press("Enter").should > 0

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:

  • (int)

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



444
445
446
447
448
# File 'lib/operawatir/desktop_browser.rb', line 444

def load_page_with_key_press(key, *modifiers)
     wait_start
     key_press_direct(key, *modifiers)
     wait_for_window_loaded("")
end

#load_window_with_action(win_name, action_name, *params) ⇒ int

Executes the action given by action_name, and waits for the window with window name win_name to be loaded

Examples:

browser.load_window_with_action("Document Window", "Open url in new page", "http://elg.no")

Parameters:

  • win_name (String)

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

  • action_name (String)

    name of the action to execute to open the window the action has to be one of those in LoadActions

  • param (String)

    optional parameter(s) to be supplied with the Opera action.

Returns:

  • (int)

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



105
106
107
108
109
110
111
112
113
# File 'lib/operawatir/desktop_browser.rb', line 105

def load_window_with_action(win_name, action_name, *params)
  if LoadActions.include?(action_name)
    wait_start
    opera_desktop_action(action_name, *params)
    wait_for_window_loaded(win_name)
  else
    raise(DesktopExceptions::UnsupportedActionException, "Action #{action_name} not supported")
  end
end

#mac?Boolean

Returns true if the test is running on Mac

Returns:

  • (Boolean)

    true we the operating system is Mac, otherwise false



577
578
579
# File 'lib/operawatir/desktop_browser.rb', line 577

def mac?
  mac_internal?
end

#open_dialog_with_url(dialog_name, url) ⇒ int

Opens a new tab and loads the url entered, then waits for a dialog to be shown based on the url entered

Examples:

browser.open_dialog_with_url("Setup Apply Dialog Confirm Dialog", \
         "http://t/platforms/desktop/bts/DSK-316777/001-1.ini")

Parameters:

  • dialog_name (String)

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

  • url (String)

    to load

Returns:

  • (int)

    Window ID of the dialog opened or 0 if no window is opened



176
177
178
179
180
181
# File 'lib/operawatir/desktop_browser.rb', line 176

def open_dialog_with_url(dialog_name, url)
  wait_start
  opera_desktop_action("Open url in new page", url)
  # The loading of the page will happen first then the dialog will be shown
  wait_for_window_shown(dialog_name)
end

#open_menu_with_key_press(menu_name, key, *modifiers) ⇒ String

Presses key and waits for the menu to show

Parameters:

  • menu_name (String)

    Name of the menu that should be opened

  • key (String)

    Key to press

Returns:

  • (String)

    name of menu that was opened, or empty



475
476
477
478
479
# File 'lib/operawatir/desktop_browser.rb', line 475

def open_menu_with_key_press(menu_name, key, *modifiers)
  wait_start
  key_press_direct(key, *modifiers)
  wait_for_menu_shown(menu_name)
end

#open_menu_with_rightclick(element, menu_name) ⇒ String

Clicks the element and waits for the menu with menu_name as given opens

Parameters:

  • element (String)

    Web page element to click (a link, an image ..)

  • menu_name (Symbol)

    Name of menu that should open when clicking the element

Returns:

  • (String)

    name of menu opened if it matches menu_name given as parameter, otherwise empty string



460
461
462
463
464
# File 'lib/operawatir/desktop_browser.rb', line 460

def open_menu_with_rightclick(element, menu_name)
  wait_start
  element.right_click
  wait_for_menu_shown(menu_name)
end

#open_pagesArray

Retrieves an array of all tabs (Document Windows)

Examples:

browser.open_pages.length.should == 2

Returns:

  • (Array)

    Array of windows



334
335
336
# File 'lib/operawatir/desktop_browser.rb', line 334

def open_pages
  quick_windows.select { |win| win.name == "Document Window" }
end

#open_window_with_action(win_name, action_name, *params) ⇒ int Also known as: open_dialog_with_action

Executes the action given by action_name, and waits for the window with window name win_name to be shown

Examples:

browser.open_window_with_action("New Preferences Dialog", "Show preferences")
browser.open_window_with_action("New Preferences Dialog", "Show preferences", "1")

Parameters:

  • win_name (String)

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

  • action_name (String)

    name of the action to execute to open the window the action cannot be a load action, see LoadActions

  • param (String)

    optional parameter(s) to be supplied with the Opera action.

Returns:

  • (int)

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



80
81
82
83
84
85
86
87
88
# File 'lib/operawatir/desktop_browser.rb', line 80

def open_window_with_action(win_name, action_name, *params)
  if LoadActions.include?(action_name) then
    raise(DesktopExceptions::UnsupportedActionException, "Action #{action_name} not supported")
  end

  wait_start
  opera_desktop_action(action_name, *params)
  wait_for_window_shown(win_name)
end

#open_window_with_key_press(win_name, key, *modifiers) ⇒ int Also known as: open_dialog_with_key_press

Presses the key, with optional modifiers, and waits for the window with window name win_name to be shown

Examples:

browser.open_window_with_key_press("New Preferences Dialog", "F12")
browser.open_window_with_key_press("New Preferences Dialog", "F12", :ctrl, :shift)

Parameters:

  • win_name (String)

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

  • 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:

  • (int)

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



129
130
131
132
133
# File 'lib/operawatir/desktop_browser.rb', line 129

def open_window_with_key_press(win_name, key, *modifiers)
  wait_start
  key_press_direct(key, *modifiers)
  wait_for_window_shown(win_name)
end

#pathString

Returns the full path to the Opera executable

Returns:

  • (String)

    Full path to the opera executable



523
524
525
# File 'lib/operawatir/desktop_browser.rb', line 523

def path
  driver.getOperaPath()
end

#quick_menuitemsObject

TODO



372
373
374
375
376
# File 'lib/operawatir/desktop_browser.rb', line 372

def quick_menuitems
  driver.getQuickMenuItemList().map do |java_item|
    QuickMenuItem.new(self, java_item)
  end.to_a
end

#quick_menusObject

TODO



365
366
367
368
369
# File 'lib/operawatir/desktop_browser.rb', line 365

def quick_menus
  driver.getQuickMenuList().map do |java_menu|
    QuickMenu.new(self, java_menu)
  end.to_a
end

#quick_tabsArray

Returns with all tabs (quick_tab).

Returns:

  • (Array)

    with all tabs (quick_tab)



416
417
418
# File 'lib/operawatir/desktop_browser.rb', line 416

def quick_tabs
  quick_tabbuttons
end

#quick_windowsArray

Retrieves an array of all windows

Examples:

browser.quick_windows.each { |win| puts win.to_s }

Returns:

  • (Array)

    Array of windows



320
321
322
323
324
# File 'lib/operawatir/desktop_browser.rb', line 320

def quick_windows
  driver.getQuickWindowList.map do |java_window|
    QuickWindow.new(self,java_window)
  end.to_a
end

#quit_driverObject

Quits the driver without exiting Opera



54
55
56
# File 'lib/operawatir/desktop_browser.rb', line 54

def quit_driver
  driver.quitDriver
end

#quit_operaObject

Quits Opera



39
40
41
# File 'lib/operawatir/desktop_browser.rb', line 39

def quit_opera
  driver.quitOpera
end

#reset_prefs(new_prefs) ⇒ Object

Reset prefs

Quits Opera and copies prefs from src to dest, then restarts Opera with the new Prefs



738
739
740
# File 'lib/operawatir/desktop_browser.rb', line 738

def reset_prefs(new_prefs)
  driver.resetOperaPrefs(new_prefs)
end

#restartObject

Restarts Opera



46
47
48
49
# File 'lib/operawatir/desktop_browser.rb', line 46

def restart
  driver.quitOpera
  driver.startOpera
end

#set_alignment_with_action(toolbar_name, alignment) ⇒ Object

Sets the alignment of a toolbar or panel

Parameters:

  • toobar_name (String)

    name of the panel or toolbar to change the alignment of

  • alignment (int)

    of the toolbar to set



251
252
253
254
# File 'lib/operawatir/desktop_browser.rb', line 251

def set_alignment_with_action(toolbar_name, alignment)
  opera_desktop_action("Set alignment", toolbar_name, alignment)
  sleep(0.1)
end

#set_preference(prefs_section, pref, value) ⇒ Object

Set preference pref in prefs section prefs_section to value specified.

Parameters:

  • prefs_section (String)

    The prefs section the pref belongs to

  • pref (String)

    The preference to set

  • value (String)

    The value to set the preference to



758
759
760
# File 'lib/operawatir/desktop_browser.rb', line 758

def set_preference(prefs_section, pref, value)
  driver.setPref(prefs_section, pref, value.to_s)
end

#small_preferences_pathString

Returns the full path to the Opera small preferences folder

Returns:

  • (String)

    Full path to the small preferences folder



541
542
543
# File 'lib/operawatir/desktop_browser.rb', line 541

def small_preferences_path
  driver.getSmallPreferencesPath()
end

#string(string_id, skip_ampersand = true) ⇒ String

Returns the language string corresponding to the string_id provided

Examples:

browser.string("D_NEW_PREFERENCES_GENERAL")

Parameters:

  • string_id

    the string_id to convert to the corresponding language string

  • skip_ampersand (defaults to: true)

    if false, then leave string as is, else (default) remove any ampersand in string

Returns:

  • (String)

    the language string corresponding to the string_id



568
569
570
# File 'lib/operawatir/desktop_browser.rb', line 568

def string(string_id, skip_ampersand = true)
  string = driver.getString(string_id, skip_ampersand)
end

#widgets(window) ⇒ Array Also known as: quick_widgets

Retrieves an array of all widgets in the window with window name win_name

Examples:

browser.widgets(window_name).each do |quick_widget|
    puts quick_widget.to_s
end

Parameters:

  • window (String)

    name or [int] id of the window to retrieve the list of widgets from,

Returns:

  • (Array)

    Array of widgets retrieved from the window



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/operawatir/desktop_browser.rb', line 269

def widgets(window)

  # If window specifies window name, and the active window has this name
  # use its id to get the widgets,
  if window.is_a? String
    active_win_id = driver.getActiveQuickWindowID()
    active_win_name = driver.getQuickWindowName(active_win_id)

    #If the active window is of same type, then grab that one, not first
    if active_win_name == window #e.g. Both Document Window
      window = active_win_id
    end
  end
  driver.getQuickWidgetList(window).map do |java_widget|
    case java_widget.getType
      when QuickWidget::WIDGET_ENUM_MAP[:button]
        QuickButton.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:checkbox]
        QuickCheckbox.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:dialogtab]
        QuickDialogTab.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:dropdown]
        QuickDropdown.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:editfield]
        QuickEditField.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:label]
        QuickLabel.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:radiobutton]
        QuickRadioButton.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:treeview]
        QuickTreeView.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:treeitem]
        QuickTreeItem.new(self,java_widget)
      when QuickWidget::WIDGET_ENUM_MAP[:thumbnail]
        QuickTreeItem.new(self,java_widget)
    else
      QuickWidget.new(self,java_widget)
    end
  end.to_a
end

#window_name(win_id) ⇒ String

Retrieves the name of a window based on it’s id

Parameters:

  • win_id (int)

    Window ID to retrieve the name for

Returns:

  • (String)

    Name of the window



427
428
429
# File 'lib/operawatir/desktop_browser.rb', line 427

def window_name(win_id)
  driver.getQuickWindowName(win_id)
end