Class: Applitools::Appium::RegionProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/appium/region_provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver, eye_region) ⇒ RegionProvider

Returns a new instance of RegionProvider.



8
9
10
11
# File 'lib/applitools/appium/region_provider.rb', line 8

def initialize(driver, eye_region)
  self.driver = driver
  self.eye_region = eye_region
end

Instance Attribute Details

#coordinate_typeObject

Returns the value of attribute coordinate_type.



6
7
8
# File 'lib/applitools/appium/region_provider.rb', line 6

def coordinate_type
  @coordinate_type
end

#driverObject

Returns the value of attribute driver.



6
7
8
# File 'lib/applitools/appium/region_provider.rb', line 6

def driver
  @driver
end

#eye_regionObject

Returns the value of attribute eye_region.



6
7
8
# File 'lib/applitools/appium/region_provider.rb', line 6

def eye_region
  @eye_region
end

Instance Method Details

#regionObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/applitools/appium/region_provider.rb', line 13

def region
  return Applitools::Region::EMPTY if
      [::Selenium::WebDriver::Element, Applitools::Selenium::Element].include? eye_region.class
  region = driver.session_capabilities['viewportRect']
  Applitools::Region.new(
    region['left'],
    region['top'],
    region['width'],
    region['height']
  )
end