Class ElementFinder
java.lang.Object
com.aquima.interactions.test.templates.session.ElementFinder
- All Implemented Interfaces:
com.aquima.interactions.composer.IVisitor
Utility class to locate an element in a page model.
- Since:
- 5.0
- Author:
- Jon van Leuven
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ElementFinder
(String searchName, Class<? extends com.aquima.interactions.composer.IElement> searchClass, int occurrenceIndex) Constructs the finder with the name of the element that should be located. -
Method Summary
Modifier and TypeMethodDescriptioncom.aquima.interactions.composer.IVisitor
accept
(com.aquima.interactions.composer.IElement element) static com.aquima.interactions.composer.IAsset
This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IAsset
findAsset
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IButton
findButton
(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IButton
findButton
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IContainer
findContainer
(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IContainer
findContainer
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IContentItem
findContentItem
(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IContentItem
findContentItem
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IElement
findElement
(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IElement
findElement
(com.aquima.interactions.composer.IContainer container, String searchName, Class<? extends com.aquima.interactions.composer.IElement> searchClass, int occurrenceIndex) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IElement
findElementSafe
(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IField
This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IField
findField
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IImage
This method locates the element with the specified name in the container.static com.aquima.interactions.composer.IImage
findImage
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) static com.aquima.interactions.composer.ITextItem
findTextItem
(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.static com.aquima.interactions.composer.ITextItem
findTextItem
(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.com.aquima.interactions.composer.IElement
This method returns the element for the specified name if found.void
leave
(com.aquima.interactions.composer.ICompositeElement container, com.aquima.interactions.composer.IVisitor childVisitor)
-
Constructor Details
-
ElementFinder
protected ElementFinder(String searchName, Class<? extends com.aquima.interactions.composer.IElement> searchClass, int occurrenceIndex) Constructs the finder with the name of the element that should be located.- Parameters:
searchName
- The name of the requested element.searchClass
- The type of the element.occurrenceIndex
- The index of the element when multiple elements with the same name are available.
-
-
Method Details
-
findElementSafe
public static com.aquima.interactions.composer.IElement findElementSafe(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name or null if the element could not be found.
-
findElement
public static com.aquima.interactions.composer.IElement findElement(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findElement
public static com.aquima.interactions.composer.IElement findElement(com.aquima.interactions.composer.IContainer container, String searchName, Class<? extends com.aquima.interactions.composer.IElement> searchClass, int occurrenceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.searchClass
- The type of the element that is requested.occurrenceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findField
public static com.aquima.interactions.composer.IField findField(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.occuranceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findField
public static com.aquima.interactions.composer.IField findField(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findButton
public static com.aquima.interactions.composer.IButton findButton(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.occuranceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findButton
public static com.aquima.interactions.composer.IButton findButton(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findContainer
public static com.aquima.interactions.composer.IContainer findContainer(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findContainer
public static com.aquima.interactions.composer.IContainer findContainer(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.occuranceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findAsset
public static com.aquima.interactions.composer.IAsset findAsset(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findAsset
public static com.aquima.interactions.composer.IAsset findAsset(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.occuranceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findContentItem
public static com.aquima.interactions.composer.IContentItem findContentItem(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findContentItem
public static com.aquima.interactions.composer.IContentItem findContentItem(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.occuranceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findTextItem
public static com.aquima.interactions.composer.ITextItem findTextItem(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findTextItem
public static com.aquima.interactions.composer.ITextItem findTextItem(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.occuranceIndex
- The index of the element when multiple elements with the same name are available.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findImage
public static com.aquima.interactions.composer.IImage findImage(com.aquima.interactions.composer.IContainer container, String searchName) This method locates the element with the specified name in the container.- Parameters:
container
- The container where the element is located in.searchName
- The name of the element that is requested.- Returns:
- The element with the specified name.
- Throws:
com.aquima.interactions.foundation.exception.AppException
- This exception is thrown when the element could not be located.
-
findImage
public static com.aquima.interactions.composer.IImage findImage(com.aquima.interactions.composer.IContainer container, String searchName, int occuranceIndex) -
getElement
public com.aquima.interactions.composer.IElement getElement()This method returns the element for the specified name if found. When no element could be found with the specified name, a null value is returned.- Returns:
- the element for the specified name, or null if the element could not be found.
-
accept
public com.aquima.interactions.composer.IVisitor accept(com.aquima.interactions.composer.IElement element) - Specified by:
accept
in interfacecom.aquima.interactions.composer.IVisitor
-
leave
public void leave(com.aquima.interactions.composer.ICompositeElement container, com.aquima.interactions.composer.IVisitor childVisitor) - Specified by:
leave
in interfacecom.aquima.interactions.composer.IVisitor
-