Java Code Examples for org.openqa.selenium.SearchContext#findElement()
The following examples show how to use
org.openqa.selenium.SearchContext#findElement() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TeasyExpectedConditions.java From teasy with MIT License | 6 votes |
private static WebElement getFirstVisibleWebElement(SearchContext searchContext, By locator) { try { final WebElement foundElement = searchContext.findElement(locator); if (isAvailable(foundElement)) { return foundElement; } else { List<WebElement> elements = searchContext.findElements(locator); for (WebElement element : elements) { if (isAvailable(element)) { return element; } } return null; } } catch (Exception e) { return null; } }
Example 2
Source File: AbstractLocator.java From phoenix.webui.framework with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public E findElement(SearchContext driver) { By by = getBy(); if(driver instanceof WebDriver) { elementWait((WebDriver) driver, getTimeout(), by); } return (E) driver.findElement(by); }
Example 3
Source File: Coordinators.java From Selenium-Foundation with Apache License 2.0 | 5 votes |
/** * An expectation for checking that an element is present on the DOM of a page. This does not * necessarily mean that the element is visible. * * @param locator used to find the element * @return the WebElement once it is located */ public static Coordinator<WebElement> presenceOfElementLocated(final By locator) { return new Coordinator<WebElement>() { /** * {@inheritDoc} */ @Override public WebElement apply(SearchContext context) { return context.findElement(locator); } /** * {@inheritDoc} */ @Override public String toString() { return "presence of element located by: " + locator; } /** * {@inheritDoc} */ @Override public TimeoutException differentiateTimeout(TimeoutException e) { return new ElementNotPresentTimeoutException(e.getMessage(), e.getCause()); } }; }
Example 4
Source File: PageObject.java From webtester-core with Apache License 2.0 | 4 votes |
private WebElement findWebElement() { SearchContext searchContext = model.getSearchContext(); return searchContext.findElement(model.getSeleniumBy()); }
Example 5
Source File: ContentMappedBy.java From java-client with Apache License 2.0 | 4 votes |
@Override public WebElement findElement(SearchContext context) { return context.findElement(map.get(currentContent)); }