Class: AutoItWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/auto_it_window.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(autoit, title, text = nil) ⇒ AutoItWindow

Returns a new instance of AutoItWindow.



6
7
8
9
10
# File 'lib/selenium/auto_it_window.rb', line 6

def initialize(autoit, title, text=nil)
  @autoit = autoit
  @title = title
  @text = text
end

Class Method Details

.on_activation(autoit, title, text = nil) {|window| ... } ⇒ Object

Yields:

  • (window)


18
19
20
21
# File 'lib/selenium/auto_it_window.rb', line 18

def self.on_activation(autoit, title, text = nil)
  window = wait_for(autoit, title, text)
  yield window
end

.wait_for(autoit, title, text = nil) ⇒ Object



12
13
14
15
16
# File 'lib/selenium/auto_it_window.rb', line 12

def self.wait_for(autoit, title, text = nil)
  window = self.new(autoit, title, text)
  window.wait_for_appear
  window
end

Instance Method Details

#activateObject



31
32
33
# File 'lib/selenium/auto_it_window.rb', line 31

def activate
  @autoit.WinActivate(@title, @text)
end

#activate_if_neededObject



52
53
54
55
# File 'lib/selenium/auto_it_window.rb', line 52

def activate_if_needed
  winstate = state
  activate unless winstate.active?
end

#active?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/selenium/auto_it_window.rb', line 35

def active?
  1 == @autoit.WinActive(@title, @text)
end

#closeObject



48
49
50
# File 'lib/selenium/auto_it_window.rb', line 48

def close
  @autoit.WinClose(@title)
end

#send_keys(keys) ⇒ Object



43
44
45
46
# File 'lib/selenium/auto_it_window.rb', line 43

def send_keys(keys)
  activate_if_needed
  @autoit.Send(keys)
end

#stateObject



39
40
41
# File 'lib/selenium/auto_it_window.rb', line 39

def state
  AutoItWindowState.new(@autoit.WinGetState(@title, @text))
end

#wait_for_activationObject



23
24
25
# File 'lib/selenium/auto_it_window.rb', line 23

def wait_for_activation
  @autoit.WinWaitActive(@title, @text, 30)
end

#wait_for_appearObject



27
28
29
# File 'lib/selenium/auto_it_window.rb', line 27

def wait_for_appear
  @autoit.WinWait(@title, @text, 30)
end