List of usage examples for org.openqa.selenium.support.pagefactory AjaxElementLocatorFactory AjaxElementLocatorFactory
public AjaxElementLocatorFactory(SearchContext searchContext, int timeOutInSeconds)
From source file:br.eti.kinoshita.selenium.BasePage.java
License:Open Source License
public BasePage(WebDriver driver, int timeOutInSeconds) { this.driver = driver; this.timeOutInSeconds = timeOutInSeconds; ElementLocatorFactory finder = new AjaxElementLocatorFactory(driver, timeOutInSeconds); PageFactory.initElements(finder, this); }
From source file:cc.kune.selenium.SeleniumModule.java
License:GNU Affero Public License
@Override protected void configure() { WebDriver driver;//from ww w . j av a 2s. c o m switch (SeleniumConf.DRIVER) { case chrome: driver = createChromeDriver(); break; case firefox: default: driver = creatFirefoxDriver(); break; } final EventFiringWebDriver wrap = new EventFiringWebDriver(driver); wrap.register(new CustomWebDriverEventListener()); bind(WebDriver.class).toInstance(wrap); bind(ElementLocatorFactory.class).toInstance(new AjaxElementLocatorFactory(wrap, SeleniumConf.TIMEOUT)); // Page Objects here! bind(LoginPageObject.class).in(Singleton.class); bind(RegisterPageObject.class).in(Singleton.class); bind(EntityHeaderPageObject.class).in(Singleton.class); bind(ChatPageObject.class).in(Singleton.class); bind(SitePageObject.class).in(Singleton.class); final ResourceBundle english = ResourceBundle.getBundle("TestConstants", Locale.ENGLISH); final ResourceBundle spanish = ResourceBundle.getBundle("TestConstants", new Locale("es")); Locale.setDefault(Locale.ENGLISH); switch (SeleniumConf.LANG) { case es: bind(ResourceBundle.class).toInstance(spanish); break; case en: default: bind(ResourceBundle.class).toInstance(english); break; } }
From source file:com.github.wiselenium.factory.WisePageFactory.java
License:Open Source License
private static FieldDecorator initDecorator(SearchContext searchContext, Field field) { FieldDecorator decorator;//from w w w . j ava2 s. c o m 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; }
From source file:org.eclipse.che.ide.ext.datasource.itests.NewDatasourceWizard.java
License:Open Source License
public String clickOnNewDatasourceAction() { mainPage.getMainMenuAction("Datasource/New Datasource Connection").click(); newDatasourceWizard = new NewDatasourceWizardPage(driver); PageFactory.initElements(new AjaxElementLocatorFactory(driver, 15), newDatasourceWizard); return "clicks"; }
From source file:org.fluentlenium.core.Fluent.java
License:Apache License
protected <T extends FluentPage> T initClass(Class<T> cls) { T page = null;//from w w w.java2s . c om try { Constructor<T> construct = cls.getDeclaredConstructor(); construct.setAccessible(true); page = construct.newInstance(); Class parent = Class.forName(Fluent.class.getName()); initDriver(page, parent); initBaseUrl(page, parent); //init fields with default proxies Field[] fields = cls.getDeclaredFields(); for (Field fieldFromPage : fields) { if (!FluentWebElement.class.isAssignableFrom(fieldFromPage.getType())) { continue; } fieldFromPage.setAccessible(true); AjaxElement elem = fieldFromPage.getAnnotation(AjaxElement.class); if (elem == null) { proxyElement(new DefaultElementLocatorFactory(getDriver()), page, fieldFromPage); } else { proxyElement(new AjaxElementLocatorFactory(getDriver(), elem.timeOutInSeconds()), page, fieldFromPage); } } } catch (ClassNotFoundException e) { throw new ConstructionException("Class " + (cls != null ? cls.getName() : " null") + "not found", e); } catch (IllegalAccessException e) { throw new ConstructionException( "IllegalAccessException on class " + (cls != null ? cls.getName() : " null"), e); } catch (NoSuchMethodException e) { throw new ConstructionException( "No constructor found on class " + (cls != null ? cls.getName() : " null"), e); } catch (InstantiationException e) { throw new ConstructionException("Unable to instantiate " + (cls != null ? cls.getName() : " null"), e); } catch (InvocationTargetException e) { throw new ConstructionException( "Cannot invoke method setDriver on " + (cls != null ? cls.getName() : " null"), e); } return page; }
From source file:org.fluentlenium.core.FluentAdapter.java
License:Apache License
private <T extends Fluent> void initFluentWebElements(T page) { for (Class classz = page.getClass(); FluentAdapter.class.isAssignableFrom(classz) || FluentPage.class.isAssignableFrom(classz); classz = classz.getSuperclass()) { for (Field fieldFromPage : classz.getDeclaredFields()) { if (isFluentWebElementField(fieldFromPage)) { fieldFromPage.setAccessible(true); AjaxElement elem = fieldFromPage.getAnnotation(AjaxElement.class); if (elem == null) { proxyElement(new DefaultElementLocatorFactory(getDriver()), page, fieldFromPage); } else { proxyElement(new AjaxElementLocatorFactory(getDriver(), elem.timeOutInSeconds()), page, fieldFromPage); }//w w w . j a v a 2 s .c o m } } } }
From source file:org.jboss.pressgang.ccms.page.AbstractPage.java
License:Open Source License
public AbstractPage(final WebDriver driver) { PageFactory.initElements(new AjaxElementLocatorFactory(driver, 30), this); this.driver = driver; ajaxWaitForTenSec = WebElementUtil.waitForTenSeconds(driver); }
From source file:org.jboss.pressgang.ccms.page.AbstractPage.java
License:Open Source License
public <P> P goToUrl(String url, P page) { log.info("Go to url: {}", url); driver.get(url);/*www . j a va2 s .co m*/ PageFactory.initElements(new AjaxElementLocatorFactory(driver, 30), page); return page; }
From source file:org.openlmis.pageobjects.AccessDeniedPage.java
License:Open Source License
public AccessDeniedPage(TestWebDriver driver) { super(driver); PageFactory.initElements(new AjaxElementLocatorFactory(TestWebDriver.getDriver(), 10), this); testWebDriver.setImplicitWait(10);/* w ww . ja v a 2 s.co m*/ }
From source file:org.openlmis.pageobjects.ApprovePage.java
License:Open Source License
public ApprovePage(TestWebDriver driver) { super(driver); PageFactory.initElements(new AjaxElementLocatorFactory(TestWebDriver.getDriver(), 10), this); testWebDriver.setImplicitWait(10);/* www .j av a 2 s . c o m*/ }