List of usage examples for org.openqa.selenium SearchContext findElement
WebElement findElement(By by);
From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java
public static void checkChangePasswordMessage(SearchContext driver1, applangoMessages changePasswordMessage) throws IOException { Assert.assertTrue(driver1.findElement(By.id(applangoObject.CHANGE_PASSWORD_MESSAGE.getValue().toString())) .getText().contains(changePasswordMessage.getValue().toString())); }
From source file:com.arcbees.test.ByDebugId.java
License:Apache License
@Override public WebElement findElement(SearchContext context) { return context.findElement(By.id(UIObject.DEBUG_ID_PREFIX + debugId)); }
From source file:com.cognifide.qa.bb.scope.nestedselector.NestedSelectorScopedElementLocator.java
License:Apache License
/** * Constructs a scope out of the scope factory and the parent field, then searches for field with * selector in this scope.//from w w w .j a va 2 s. com */ @Override public WebElement findElement() { SearchContext context = scopeFactory instanceof ParentElementLocatorProvider && !globalCurrentScope ? ((ParentElementLocatorProvider) scopeFactory).getCurrentScope().findElement() : searchContext; return context.findElement(selector); }
From source file:com.comcast.dawg.house.AdvanceFilterNavigator.java
License:Apache License
/** * Helper method to verify if a button is enabled * @param parent The parent of the button * @param className The class name used to look it up in the parent * @param enabled true if the button should be enabled, false if it should be disabled *///from w w w . j a v a 2s . c o m private void assertEnabled(SearchContext parent, String className, boolean enabled) { WebElement btn = parent.findElement(By.className(className)); Assert.assertEquals(btn.isEnabled(), enabled); }
From source file:com.epam.jdi.uitests.mobile.appium.elements.apiInteract.GetElementModule.java
License:Open Source License
private SearchContext getSearchContext(Object element) { Object p;/*from w w w .j a va 2s . c o m*/ BaseElement bElement; Element el; if (element == null || !isClass(element.getClass(), BaseElement.class) || ((p = (bElement = (BaseElement) element).getParent()) == null && bElement.avatar.frameLocator == null)) return getDriver().switchTo().defaultContent(); if (isClass(bElement.getClass(), Element.class) && (el = (Element) bElement).avatar.hasWebElement()) return el.getWebElement(); By locator = bElement.getLocator(); SearchContext searchContext = containsRoot(locator) ? getDriver().switchTo().defaultContent() : getSearchContext(p); locator = containsRoot(locator) ? trimRoot(locator) : locator; By frame = bElement.avatar.frameLocator; if (frame != null) getDriver().switchTo().frame((WebElement) getDriver().findElement(frame)); return locator != null ? searchContext.findElement(correctXPaths(locator)) : searchContext; }
From source file:com.epam.jdi.uitests.web.selenium.elements.apiInteract.GetElementModule.java
License:Open Source License
private SearchContext getSearchContext(Object element) { if (element == null || !isClass(element.getClass(), BaseElement.class)) return getDriver().switchTo().defaultContent(); BaseElement bElement = (BaseElement) element; if (bElement.useCache && isClass(bElement.getClass(), Element.class)) { Element el = (Element) bElement; if (el.avatar.hasWebElement()) return el.webElement; }/*from ww w.j a v a2 s .c o m*/ Object p = bElement.getParent(); if (p == null && bElement.avatar.frameLocator == null) return getDriver().switchTo().defaultContent(); By locator = bElement.getLocator(); SearchContext searchContext = containsRoot(locator) ? getDriver().switchTo().defaultContent() : getSearchContext(p); locator = containsRoot(locator) ? trimRoot(locator) : locator; By frame = bElement.avatar.frameLocator; if (frame != null) getDriver().switchTo().frame(getDriver().findElement(frame)); return locator != null ? searchContext.findElement(correctXPaths(locator)) : searchContext; }
From source file:com.ggasoftware.jdiuitest.web.selenium.elements.apiInteract.GetElementModule.java
License:Open Source License
private SearchContext getSearchContext(Pairs<ContextType, By> context) { SearchContext searchContext = getDriver().switchTo().defaultContent(); for (Pair<ContextType, By> locator : context) { WebElement element = searchContext.findElement(locator.value); if (locator.key == ContextType.Locator) searchContext = element;//from ww w .jav a 2 s . co m else { getDriver().switchTo().frame(element); searchContext = getDriver(); } } return searchContext; }
From source file:com.github.wiselenium.Wiselenium.java
License:Open Source License
/** * Finds the first element within the search context using the given mechanism. <br/> * Throws a NoSuchElementException if the element couldn't be found. <br/> * // w w w . ja va 2 s.c om * @param clazz The class of the element. * @param by The locating mechanism to use. * @param searchContext The search context. * @return The element. * @since 0.3.0 */ public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); }
From source file:com.gwtplatform.carstore.cucumber.application.BasePage.java
License:Apache License
protected WebElement waitUntilElementIsLoaded(final SearchContext parent, final By locator) { return webDriverWait().until(new ExpectedCondition<WebElement>() { @Override/*from ww w . j a v a 2s . co m*/ public WebElement apply(WebDriver input) { return parent.findElement(locator); } }); }
From source file:com.ibm.sbt.automation.core.environment.TestEnvironment.java
License:Open Source License
/** * Find the basic authentication login form *///w ww.j av a2 s.com protected WebElement findLoginForm(SearchContext wd, String[] ids, String[] xpathExprs) { for (int i = 0; i < ids.length; i++) { if (StringUtil.isNotEmpty(ids[i])) { try { if (ids[i] != null) { WebElement loginForm = wd.findElement(By.id(ids[i])); if (loginForm != null) { return loginForm; } } } catch (Exception e) { } } } for (int i = 0; i < xpathExprs.length; i++) { if (StringUtil.isNotEmpty(xpathExprs[i])) { try { if (xpathExprs[i] != null) { WebElement loginForm = wd.findElement(By.xpath(xpathExprs[i])); if (loginForm != null) { return loginForm; } } } catch (Exception e) { } } } return null; }