percy/providers/generic_provider.rb in percy-appium-app-0.0.5 vs percy/providers/generic_provider.rb in percy-appium-app-0.0.6
- old
+ new
@@ -104,12 +104,12 @@
filepath
end
def get_region_object(selector, element)
scale_factor = metadata.scale_factor
- location = hashed(element.location)
- size = hashed(element.size)
+ location = { 'x' => element.location.x, 'y' => element.location.y }
+ size = { 'height' => element.size.height, 'width' => element.size.width }
coordinates = {
'top' => location['y'] * scale_factor,
'bottom' => (location['y'] + size['height']) * scale_factor,
'left' => location['x'] * scale_factor,
'right' => (location['x'] + size['width']) * scale_factor
@@ -131,10 +131,12 @@
end
end
def get_regions_by_ids(elements_array, ids)
ids.each do |id|
- element = driver.find_element(Appium::Core::Base::SearchContext::FINDERS[:accessibility_id], id)
+ # Appium::Core::Base::SearchContext::FINDERS[:xpath] returns `accessibility id`
+ # instead of `:accessibility_id`, causes error
+ element = driver.find_element(:accessibility_id, id)
selector = "id: #{id}"
region = get_region_object(selector, element)
elements_array << region
rescue Appium::Core::Error::NoSuchElementError => e
log("Appium Element with id: #{id} not found. Ignoring this id.")