Class: Mohawk::Adapters::UIA::Control
- Inherits:
-
Object
- Object
- Mohawk::Adapters::UIA::Control
show all
- Includes:
- Waiter
- Defined in:
- lib/mohawk/adapters/uia/control.rb
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Waiter
#wait_until
Constructor Details
#initialize(adapter, locator) ⇒ Control
Returns a new instance of Control.
15
16
17
18
|
# File 'lib/mohawk/adapters/uia/control.rb', line 15
def initialize(adapter, locator)
@parent = adapter.window.element
@locator = locator
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/mohawk/adapters/uia/control.rb', line 62
def method_missing(meth, *args, &block)
if element.respond_to? meth
element.send meth, *args, &block
else
super
end
end
|
Class Attribute Details
.patterns ⇒ Object
Returns the value of attribute patterns.
8
9
10
|
# File 'lib/mohawk/adapters/uia/control.rb', line 8
def patterns
@patterns
end
|
Class Method Details
.valid_patterns(*patterns) ⇒ Object
10
11
12
|
# File 'lib/mohawk/adapters/uia/control.rb', line 10
def valid_patterns(*patterns)
@patterns = patterns
end
|
Instance Method Details
#click ⇒ Object
20
21
22
|
# File 'lib/mohawk/adapters/uia/control.rb', line 20
def click
element.click
end
|
#disabled? ⇒ Boolean
37
38
39
|
# File 'lib/mohawk/adapters/uia/control.rb', line 37
def disabled?
!enabled?
end
|
#element ⇒ Object
45
46
47
|
# File 'lib/mohawk/adapters/uia/control.rb', line 45
def element
@element ||= wait_until { locate_element }
end
|
#enabled? ⇒ Boolean
33
34
35
|
# File 'lib/mohawk/adapters/uia/control.rb', line 33
def enabled?
exist? && element.enabled?
end
|
#exist? ⇒ Boolean
Also known as:
exists?
28
29
30
|
# File 'lib/mohawk/adapters/uia/control.rb', line 28
def exist?
locate_element != nil
end
|
#focus ⇒ Object
24
25
26
|
# File 'lib/mohawk/adapters/uia/control.rb', line 24
def focus
element.focus
end
|
#handle ⇒ Object
49
50
51
|
# File 'lib/mohawk/adapters/uia/control.rb', line 49
def handle
element.handle
end
|
#value ⇒ Object
Also known as:
control_name
53
54
55
|
# File 'lib/mohawk/adapters/uia/control.rb', line 53
def value
element.name
end
|
#view ⇒ Object
58
59
60
|
# File 'lib/mohawk/adapters/uia/control.rb', line 58
def view
self
end
|
#visible? ⇒ Boolean
41
42
43
|
# File 'lib/mohawk/adapters/uia/control.rb', line 41
def visible?
exist? && element.visible?
end
|