List of usage examples for org.openqa.selenium WebDriver findElement
@Override WebElement findElement(By by);
From source file:com.cognifide.aet.job.common.modifiers.login.LoginFormComponent.java
License:Apache License
private WebElement getElementByXpath(WebDriver webDriver, String xpathExpression) { WebDriverWait wait = new WebDriverWait(webDriver, TIMEOUT); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpathExpression))); return webDriver.findElement(By.xpath(xpathExpression)); }
From source file:com.cognifide.qa.bb.aem.expectedconditions.ContentFinderActions.java
License:Apache License
/** * Expands content finder and checks if expand button hides. * * @return condition for content finder to be expanded */// w w w . j av a2 s . co m public static ExpectedCondition<Boolean> expand() { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { WebElement expandButton = driver.findElement(By.cssSelector(EXPAND_BUTTON_CSS)); expandButton.click(); return !expandButton.isDisplayed(); } @Override public String toString() { return String.format(VIEW_IS_NOT_READY); } }; }
From source file:com.coinbot.captcha.SolveMedia.java
License:Open Source License
@Override public void answerToInput(WebDriver driver) { WebElement input = driver.findElement(By.id("adcopy_response")); input.sendKeys(getAnswer());//from w w w .ja va 2s . c o m }
From source file:com.comcast.magicwand.drivers.AbstractPhoenixDriver.java
License:Apache License
/** * {@inheritDoc}/*from w w w . j a v a 2 s . com*/ */ public WebElement findElement(By arg0) { WebDriver driver = this.getDriver(); WebElement element = null; if (null != driver) { element = driver.findElement(arg0); } return element; }
From source file:com.common.ExpectedConditions.java
License:Apache License
public static ExpectedCondition<Boolean> elementSelectionStateToBe(final By locator, final boolean selected) { return new ExpectedCondition<Boolean>() { @Override/*from w ww .j ava 2 s . c om*/ public Boolean apply(WebDriver driver) { try { WebElement element = driver.findElement(locator); return element.isSelected() == selected; } catch (StaleElementReferenceException e) { return null; } } @Override public String toString() { return String.format("element found by %s to %sbe selected", locator, (selected ? "" : "not ")); } }; }
From source file:com.common.ExpectedConditions.java
License:Apache License
/** * Looks up an element. Logs and re-throws WebDriverException if thrown. <p/> * Method exists to gather data for http://code.google.com/p/selenium/issues/detail?id=1800 * * @param driver WebDriver// w ww. j a v a 2 s. c om * @param by locator * @return WebElement found */ private static WebElement findElement(By by, WebDriver driver) { try { return driver.findElement(by); } catch (NoSuchElementException e) { throw e; } catch (WebDriverException e) { log.log(Level.WARNING, String.format("WebDriverException thrown by findElement(%s)", by), e); throw e; } }
From source file:com.company.components.impl.SearchBoxImpl.java
License:Apache License
private ExpectedCondition<Boolean> suggestionBoxShown() { return new ExpectedCondition<Boolean>() { @Override// www. ja v a 2 s . co m public Boolean apply(WebDriver driver) { By by = By.cssSelector("div.suggestions"); return driver.findElement(by).isDisplayed(); } }; }
From source file:com.continuuity.test.TestUtil.java
License:Apache License
public Set<String> getLeftPanel(WebDriver driver) { Set<String> leftPanel = Sets.newHashSet(); leftPanel.add(driver.findElement(Constants.NAV_CLUSTERS).getText()); leftPanel.add((driver.findElement(Constants.NAV_PROVIDERS).getText())); leftPanel.add(driver.findElement(Constants.NAV_HARDWARETYPES).getText()); leftPanel.add(driver.findElement(Constants.NAV_IMAGETYPES).getText()); leftPanel.add(driver.findElement(Constants.NAV_SERVICES).getText()); return leftPanel; }
From source file:com.daarons.transfer.UploadTask.java
License:Apache License
private boolean isUploadTimeAvailable(WebDriverWait wait) { //checks to see if the time until the upload is finished is on the screen boolean isUploadTimeAvailable; try {// www . ja va 2 s .co m isUploadTimeAvailable = wait.until((ExpectedCondition<Boolean>) (WebDriver driver2) -> driver2 .findElement(By.cssSelector( "body > div > div > div.transfer.transfer--half-panel > div > div.transfer__contents > p:nth-child(4)")) .getText().length() != 0); } catch (org.openqa.selenium.TimeoutException ex) { log.error("Time until upload is finished could not be found", ex); isUploadTimeAvailable = false; //remove and make false at start of method } return isUploadTimeAvailable; }
From source file:com.daarons.transfer.UploadTask.java
License:Apache License
private boolean isOkButtonClickable(WebDriverWait wait) { //checks to see if the Ok Button is ready to be clicked meaning upload is finished boolean isOkButtonClickable; try {//from ww w . j av a 2 s . c om isOkButtonClickable = wait.until((ExpectedCondition<Boolean>) (WebDriver driver2) -> !driver2 .findElement(By.className("transfer__button")).getText().equals("Transfer") && !driver2.findElement(By.className("transfer__button")).getText().equals("Cancel")); } catch (Exception ex) { log.error(ex); isOkButtonClickable = false; } return isOkButtonClickable; }