package cz.moneta.test.harness.support.web;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * GetElementContent annotation is used for getting text value from element and returning it. Return type of annotated
 * method has to be String.<br>
 * Value from html below is "Content text".
 *    <pre>
 *     &lt;div&gt;Content text&lt;/div&gt;
 *    </pre>
 * <u>Example:</u>
 *    <pre>
 *        {@literal @}GetElementContent (SOME_VALUE)
 *         String someElement();
 *    </pre>
 * HarnessException is thrown if element is NOT readable (see example below).
 *    <pre>
 *      &lt;input title="title text [CIF001_S001_E013]" id="CIF001_S001_E013"&gt;
 *    </pre>
 *
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example2:</u><br>
 *    <pre>
 *         {@literal @}GetElementContent{
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          String someElement();
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface GetElementContent {

    /**
     * Value for identification of select element.
     */
    String value();

    /**
     * Type of element identification which will be used for element search. See {@link Lookup} for exact types.
     */
    Lookup by() default Lookup.DEFAULT;
}
