Module: Applitools::UniversalNewApi

Included in:
EyesBase
Defined in:
lib/applitools/core/universal_new_api.rb

Instance Method Summary collapse

Instance Method Details

#extract_text(targets_array) ⇒ Object

export type OCRExtractSettings<TElement, TSelector> =

target: RegionReference<TElement, TSelector>
hint?: string
minMatch?: number
language?: string



12
13
14
15
16
17
18
# File 'lib/applitools/core/universal_new_api.rb', line 12

def extract_text(targets_array)
  targets_array.map do |target|
    target['target'] = { elementId: target['target'].ref } if target['target'].is_a?(::Selenium::WebDriver::Element)
    target
  end
  universal_eyes.extract_text(targets_array)
end

#extract_text_regions(patterns_array) ⇒ Object

export type OCRSearchSettings<TPattern extends string> =

patterns: TPattern[]
ignoreCase?: boolean
firstOnly?: boolean
language?: string



27
28
29
30
# File 'lib/applitools/core/universal_new_api.rb', line 27

def extract_text_regions(patterns_array)
  results = universal_eyes.extract_text_regions(patterns_array)
  Applitools::Utils.deep_stringify_keys(results)
end

#locate(locate_settings) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/applitools/core/universal_new_api.rb', line 33

def locate(locate_settings)
  settings = {
    locatorNames: locate_settings[:locator_names],
    firstOnly: !!locate_settings[:first_only]
  }
  results = universal_eyes.locate(settings)
  Applitools::Utils.deep_stringify_keys(results)
end