Class: YuiRestClient::Widgets::Textbox

Inherits:
Base
  • Object
show all
Defined in:
lib/yui_rest_client/widgets/textbox.rb

Overview

Class representing a textbox in the UI. It can be YInputField.

Instance Method Summary collapse

Methods inherited from Base

#action, #collect_all, #debug_label, #enabled?, #exists?, #initialize, #property

Methods included from YuiRestClient::Waitable

#wait_until, #wait_while

Constructor Details

This class inherits a constructor from YuiRestClient::Widgets::Base

Instance Method Details

#max_lengthInteger

Returns maximum string length to set in the textbox

Examples:

Check maximum string length in textbox with id ‘test’

{
   "class": "YInputField",
   "debug_label": "label_test",
   "hstretch": true,
   "id": "test",
   "input_max_length": 256,
   "label": "label_test",
   "password_mode": false,
   "valid_chars": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.",
   "value": ""
}
app.textbox(id: 'test').max_length

Returns:

  • (Integer)

    maximum number of character to set in the textbox



23
24
25
# File 'lib/yui_rest_client/widgets/textbox.rb', line 23

def max_length
  property(:input_max_length)
end

#password?Boolean

Check if textbox has password mode

Examples:

Check password mode in textbox with id ‘test’

{
   "class": "YInputField",
   "debug_label": "label_test",
   "hstretch": true,
   "id": "test",
   "label": "label_test",
   "password_mode": false,
   "value": ""
}
app.textbox(id: 'test').password?

Returns:

  • (Boolean)

    true if has password mode, otherwise false



51
52
53
# File 'lib/yui_rest_client/widgets/textbox.rb', line 51

def password?
  property(:password_mode)
end

#set(value) ⇒ Textbox

Sends action to set the value of textbox.

Examples:

Set text in textbox with id ‘test’ to ‘my value’

app.textbox(id: 'test').set('my value')

Parameters:

  • value (String)

    text to be set in textbox

Returns:

  • (Textbox)

    in case action is successful



32
33
34
35
# File 'lib/yui_rest_client/widgets/textbox.rb', line 32

def set(value)
  action(action: Actions::ENTER_TEXT, value: value)
  self
end

#valid_charsString

Returns valid chars to set in the textbox

Examples:

Check password mode in textbox with id ‘test’

{
   "class": "YInputField",
   "debug_label": "label_test",
   "hstretch": true,
   "id": "test",
   "label": "label_test",
   "password_mode": false,
   "valid_chars": "0123456789",
   "value": ""
}
app.textbox(id: 'test').valid_chars

Returns:

  • (String)

    containing all valid chars



70
71
72
# File 'lib/yui_rest_client/widgets/textbox.rb', line 70

def valid_chars
  property(:valid_chars)
end

#valueString

Returns text that is currently set for textbox. Gets value from ‘value’ parameter in JSON representation of YInputField.

Examples:

Get value from textbox with id “address”

{
    "class": "YInputField",
    "debug_label": "Address",
    "hstretch": true,
    "id": "address",
    "label": "A&ddress",
    "password_mode": false,
    "value": "Test Address"
}
app.textbox(id: 'address').value # Test Address

Returns:

  • (String)

    value



89
90
91
# File 'lib/yui_rest_client/widgets/textbox.rb', line 89

def value
  property(:value)
end