/** * This method creates the object of type clazz within context defined by the top web element and the * frame path provided as the parameter. * * @param clazz PageObject class. * @param framePath instance of FramePath. * @param <T> type of PageObject class that will be returned. * @return instance of Injector. */ public <T> T inject(Class<T> clazz, FramePath framePath) { final ElementLocatorFactory elementLocatorFactory = new DefaultElementLocatorFactory(webDriver); stack.push(new PageObjectContext(elementLocatorFactory, framePath)); try { return injector.getInstance(clazz); } finally { stack.pop(); } }
public HighCharts(WebDriver driver, WebElement chart) { PageFactory.initElements(new DefaultElementLocatorFactory(chart), this); this.driver = driver; this.chart = chart; int waitTimeoutInSeconds = 15; wait = new WebDriverWait(driver, waitTimeoutInSeconds, 100); performAction = new Actions(driver); }
private static FieldDecorator initDecorator(SearchContext searchContext, Field field) { FieldDecorator decorator; AjaxElement ajaxElementAnnotation = field.getAnnotation(AjaxElement.class); if (ajaxElementAnnotation != null) { int timeout = ajaxElementAnnotation.timeOutInSeconds(); decorator = new WiseDecorator(new AjaxElementLocatorFactory(searchContext, timeout)); } else { decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); } return decorator; }
public Form(SearchContext context) { PageFactory.initElements(new DefaultElementLocatorFactory(context), this); }
public Attribute(SearchContext context) { PageFactory.initElements(new DefaultElementLocatorFactory(context), this); }
public SelenideAppiumFieldDecorator(SearchContext context) { super(context); this.searchContext = context; this.factory = new DefaultElementLocatorFactory(searchContext); }
private PageObjectContext getDefaultPageObjectContext(WebDriver webDriver) { ElementLocatorFactory elementLocatorFactory = new DefaultElementLocatorFactory(webDriver); FramePath framePath = new FramePath(); return new PageObjectContext(elementLocatorFactory, framePath); }
public HighCharts(WebDriver driver, WebElement chart) { PageFactory.initElements(new DefaultElementLocatorFactory(chart), this); this.driver = driver; this.chart = chart; }
/** * Recreate the page after a reload, this is important if the weblements are * cached. */ public final void isReloaded() { PageFactory.initElements(new ElementDecorator(webDriver, new DefaultElementLocatorFactory(webDriver), pageName, ""), this); }
/** * Finds all elements within the search context using the given mechanism. <br/> * An empty list will be returned if the elements couldn't be found. <br/> * * @param clazz The class of the elements. * @param by The locating mechanism to use. * @param searchContext The search context. * @return The list of elements. * @since 0.3.0 */ public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) { List<WebElement> webElements = searchContext.findElements(by); if (webElements.isEmpty()) return Lists.newArrayList(); WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext)); return decorator.decorate(clazz, webElements); }
/** * Decorates a webElement. * * @param clazz The class of the decorated element. Must be either WebElement or a type * annotated with Component or Frame. * @param webElement The webElement that will be decorated. * @return The decorated element or null if the type isn't supported. * @since 0.3.0 */ public static <E> E decorateElement(Class<E> clazz, WebElement webElement) { WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(webElement)); return decorator.decorate(clazz, webElement); }