Class: OperaWatir::QuickEditField
- Inherits:
-
QuickWidget
- Object
- QuickWidget
- OperaWatir::QuickEditField
- Defined in:
- lib/operawatir/quickwidgets/quick_editfield.rb
Direct Known Subclasses
QuickAddressField, QuickDropdown, QuickDropdownItem, QuickSearchField
Constant Summary
Constants inherited from QuickWidget
OperaWatir::QuickWidget::ConditionTimeout
Instance Method Summary collapse
-
#clear ⇒ Object
Clears the contents of the edit field.
-
#focus_with_click ⇒ Object
Sets focus to the edit field by clicking on it.
-
#key_press(key, *modifiers) ⇒ String
Presses a key including modifiers.
-
#type_text(text, wait = 0) ⇒ String
Types a text string into the edit field.
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
#clear ⇒ Object
Clears the contents of the edit field
51 52 53 54 55 56 57 58 59 |
# File 'lib/operawatir/quickwidgets/quick_editfield.rb', line 51 def clear focus_with_click key_press_direct("a", :ctrl) key_press_direct("backspace") # Cheat until we have an event sleep(0.1) end |
#focus_with_click ⇒ Object
Sets focus to the edit field by clicking on it
19 20 21 |
# File 'lib/operawatir/quickwidgets/quick_editfield.rb', line 19 def focus_with_click super end |
#key_press(key, *modifiers) ⇒ String
The edit field must have focus for this method to work
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
78 79 80 81 82 83 84 85 86 |
# File 'lib/operawatir/quickwidgets/quick_editfield.rb', line 78 def key_press(key, *modifiers) key_press_direct(key, *modifiers) # Cheat until we have an event sleep(0.1) # Return what is in the field to check element(true).getText end |
#type_text(text, wait = 0) ⇒ String
Only characters that appear on the keyboard that is currently selected can be typed, and the edit field must have focus.
Types a text string into the edit field
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/operawatir/quickwidgets/quick_editfield.rb', line 34 def type_text(text, wait = 0) text.each_char { | t | key_press_direct t } # No event yet so just cheat and sleep sleep(0.2) # Return what is in the field to check text = element(true).getText sleep(wait) if wait != 0 text end |