Class: RUTL::Interface::WindowsApp

Inherits:
Base
  • Object
show all
Defined in:
lib/rutl/interface/windows/windows_app.rb

Overview

Parent class for all Windows apps.

Direct Known Subclasses

Hello, Notepad

Constant Summary

Constants included from Waiter

Waiter::DEFAULT_TIMEOUT, Waiter::POLL_SLEEP_TIME

Instance Attribute Summary

Attributes inherited from Base

#camera, #driver, #views

Instance Method Summary collapse

Methods inherited from Base

#current_view, #find_state, #find_view, #goto, #initialize, #method_missing, #respond_to_missing?, #wait_for_transition

Methods included from Waiter

#await

Methods included from CheckView

#view?

Constructor Details

This class inherits a constructor from RUTL::Interface::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RUTL::Interface::Base

Instance Method Details

#base_optsObject



10
11
12
13
14
15
16
# File 'lib/rutl/interface/windows/windows_app.rb', line 10

def base_opts
  { caps: { platformName: 'WINDOWS',
            platform: 'WINDOWS',
            deviceName: 'WindowsPC' },
    appium_lib: { wait_timeout: 2,
                  wait_interval: 0.01 } }
end

#killObject



18
19
20
# File 'lib/rutl/interface/windows/windows_app.rb', line 18

def kill
  system "taskkill /f /im #{@app_name} /t 1>nul 2>&1"
end

#open?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
# File 'lib/rutl/interface/windows/windows_app.rb', line 22

def open?
  @driver.find_elements(:id, 0)
  true
rescue Selenium::WebDriver::Error::NoSuchWindowError
  false
end

#quitObject



29
30
31
32
# File 'lib/rutl/interface/windows/windows_app.rb', line 29

def quit
  @driver.driver_quit
  kill
end