List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated
public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator)
From source file:com.hotwire.selenium.bex.BexAbstractPage.java
License:Open Source License
protected void clickOnLink(String linkText, int waitTimeout) { new WebDriverWait(getWebDriver(), waitTimeout) .until(ExpectedConditions.visibilityOfElementLocated(By.linkText(linkText))).click(); }
From source file:com.hotwire.selenium.bex.BexAbstractPage.java
License:Open Source License
protected boolean isElementDisplayed(By byElement, int wait) { try {/*from ww w .j a va 2 s.c om*/ new WebDriverWait(getWebDriver(), wait).until(ExpectedConditions.visibilityOfElementLocated(byElement)); return true; } catch (TimeoutException | NoSuchElementException | ElementNotVisibleException e) { return false; } }
From source file:com.hotwire.selenium.desktop.helpCenter.HelpCenterAbstractPage.java
License:Open Source License
/** * Major Page Object constructor.//from ww w . ja v a2s.c om * webdriver - gets from getter getWebDriverInstance() in WebDriverAwareModel * keyPageElement - element defined that page is loaded. * */ public HelpCenterAbstractPage(WebDriver webdriver, By keyPageElement) { super(webdriver); new WebDriverWait(webdriver, PAGE_WAIT) .until(ExpectedConditions.visibilityOfElementLocated(keyPageElement)); }
From source file:com.hotwire.selenium.desktop.helpCenter.HelpCenterAbstractPage.java
License:Open Source License
public HelpCenterAbstractPage(WebDriver webdriver, By keyPageElement, Integer pageWait) { super(webdriver); new WebDriverWait(webdriver, pageWait).until(ExpectedConditions.visibilityOfElementLocated(keyPageElement)); }
From source file:com.hotwire.selenium.desktop.helpCenter.Salesforce.SFArticlePage.java
License:Open Source License
public void clickAnyStar() { int starNumber = getRandomStarNumber(starsCount()); stars.get(starNumber).click();//from w ww . ja v a 2 s . c o m new WebDriverWait(getWebDriver(), 5) .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(CSS_FEEDBACK_AREA))); }
From source file:com.hotwire.selenium.desktop.helpCenter.Salesforce.SFArticlePage.java
License:Open Source License
public List<String> getPhones() { List<String> results = new ArrayList<>(); try {// w w w . j a v a 2 s .c o m new WebDriverWait(getWebDriver(), 2) .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.contactUsBlock"))); List<WebElement> phones = getWebDriver().findElements(By.cssSelector("div.phoneRow")); String[] usPhones = phones.get(0).getText().split("\n"); results.add(usPhones[2]); results.add(usPhones[3]); results.add(phones.get(1).getText().split("\n")[1]); return results; } catch (TimeoutException e) { return null; } }
From source file:com.hotwire.selenium.desktop.helpCenter.Salesforce.SFArticlePage.java
License:Open Source License
public List<String> getExpressPhones() { List<String> results = new ArrayList<>(); try {/*from www .j a v a2s .c om*/ new WebDriverWait(getWebDriver(), 2) .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.contactUsBlock"))); List<WebElement> phones = getWebDriver().findElements(By.cssSelector("div.phoneRow")); String[] usPhones = phones.get(0).getText().split("\n"); results.add(usPhones[2]); results.add(phones.get(1).getText().split("\n")[1]); return results; } catch (TimeoutException e) { return null; } }
From source file:com.hotwire.selenium.desktop.row.search.AbstractFareFinder.java
License:Open Source License
@Override public FareFinder setDestinationLocation(String destinationLocation) { location.setText(destinationLocation); try {//from w w w .j a va 2 s. c om WebElement autocomplete = new WebDriverWait(getWebDriver(), 5) .until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//input[@id='location']/..//div[@class='yui-ac-content']"))); autocomplete.sendKeys(Keys.ESCAPE); } catch (TimeoutException e) { logger.info("Autocomplete failed to become visible... Continuing..."); } return this; }
From source file:com.hotwire.selenium.desktop.row.search.AbstractFareFinder.java
License:Open Source License
@Override public List<String> getSearchSuggestions(String destinationLocation) { List<String> searchSuggestions = new ArrayList<String>(); location.setText(destinationLocation); // Do not debug this code! When browser loose focus it closes autocomplete popup. new WebDriverWait(getWebDriver(), 10, WebDriverWait.DEFAULT_SLEEP_TIMEOUT).until( ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.yui-ac-content ul li div"))); for (WebElement e : getWebDriver().findElements(By.cssSelector("div.yui-ac-content ul li div"))) { searchSuggestions.add(e.getAttribute("title")); }/*from w w w.j a v a 2 s .c om*/ // Bad magic is done, feel free to debug... return searchSuggestions; }
From source file:com.hotwire.selenium.desktop.us.billing.air.AirCreditCardFragment.java
License:Open Source License
public AirCreditCardFragment withCcType(String creditCardType) { try {//from w w w . j a va2 s .c om if (getWebDriver().findElements(By.name("paymentForm.selectedCardType")).size() > 0) { new WebDriverWait(getWebDriver(), 5).until( ExpectedConditions.visibilityOfElementLocated(By.name("paymentForm.selectedCardType"))); new Select(getWebDriver().findElement(By.name("paymentForm.selectedCardType"))) .selectByVisibleText(creditCardType); } } catch (NoSuchElementException e) { LOGGER.info("Type of credit card is not available!"); } return this; }