capybaraappiumsite-prism

Site Prism: Cannot use xpath locator strategy from an elements within sections


I am using SitePrism 2.6 and getting error Cannot use xpath locator strategy from an element. It can only be used from root element.

Defined the section element using xpath.

Section element is of type X, So I have X class in which I have defined child elements using xpath.

ex: section :abc_cell, X, xpath: '//xpath'

Class X < SitePrism::Section

  label :xyz, xpath: '//xpath'

end

When trying to access the page_object.abc_cell.xyz_label getting error:

Cannot use xpath locator strategy from an element. It can only be used from root element.

Why is this happening in android?


Solution

  • This looks to be a known-issue in Appium for both iOS and android.

    https://github.com/appium/appium/blob/74c4ec1a20c1f20cd2ef0b821d314b02957c82bb/lib/devices/android/android-controller.js#L44