PageObjectUIElementProvider

public protocol PageObjectUIElementProvider : AnyObject

Abstract object to provide a XCUIElement given a specific AIP element.

Example:

 extension HomePage: PageObjectUIElementProvider, PageObject {
     func uiElement(for element: Element, in queryProvider: XCUIElementTypeQueryProvider) -> XCUIElement {
         let query = self.query(for: element, in: queryProvider)

         let identifier = HomeAIP.elementIdentifier(for: element)
         return query[identifier]
     }

     private func query(for element: Element, in queryProvider: XCUIElementTypeQueryProvider) -> XCUIElementQuery {
         switch element {
         case .mainView:
         return queryProvider.otherElements
         case .tableView:
         return queryProvider.tables
     }
 }

  • Undocumented

    Declaration

    Swift

    associatedtype Element
  • Method to provide a XCUIElement given a specific AIP element.

    Declaration

    Swift

    func uiElement(for element: Element, in queryProvider: XCUIElementTypeQueryProvider) -> XCUIElement

    Parameters

    element

    AIP element to convert.

    queryProvider

    Provider where to find the XCUIElement element. Default: XCUIApplication().

    Return Value

    the XCUIElement found.