List of usage examples for org.openqa.selenium By cssSelector
public static By cssSelector(String cssSelector)
From source file:com.ecofactor.qa.automation.newapp.page.impl.HelpOverlayPageImpl.java
License:Open Source License
/** * Gets the current page element.//from w w w.java 2 s. c o m * @return the current page element */ public HelpPage getCurrentPage() { WebElement currentPageElement = null; HelpPage currentPage = null; currentPageElement = getElement(getDriver(), By.cssSelector("div.help_slide"), TINY_TIMEOUT); for (final HelpPage page : HelpPage.values()) { currentPageElement = getElement(getDriver(), By.cssSelector("div.help_slide"), TINY_TIMEOUT); if (currentPageElement != null) { currentPage = page; getAction().click(getNextButton()); WaitUtil.tinyWait(); break; } } getAction().click(getNextButton()); WaitUtil.tinyWait(); return currentPage; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.HelpOverlayPageImpl.java
License:Open Source License
/** * Check swipe away menu help.// ww w . ja v a 2s . c o m * @see com.ecofactor.qa.automation.newapp.page.HelpOverlayPage#checkSwipeAwayMenuHelp() */ @Override public void checkSwipeAwayMenuHelp() { setLogString("1. Check Away Help is displayed.", true); Assert.assertTrue( isDisplayed(getDriver(), By.cssSelector(IMG_SRC + AWAY_IMG + CLOSE_BRACKET), TINY_TIMEOUT)); setLogString("2. Check Menu Help is displayed.", true); Assert.assertTrue( isDisplayed(getDriver(), By.cssSelector(IMG_SRC + MENU_IMG + CLOSE_BRACKET), TINY_TIMEOUT)); setLogString("3. Check Swipe Help is displayed.", true); final Object value = executeScriptByClassName("slide_2", "background-image", getDriver()); Assert.assertTrue(value.toString().contains(SWIPE_IMG)); setLogString("4. Check Savings Help is displayed.", true); Assert.assertTrue( isDisplayed(getDriver(), By.cssSelector(IMG_SRC + SAVINGS_IMG + CLOSE_BRACKET), TINY_TIMEOUT)); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.HelpOverlayPageImpl.java
License:Open Source License
/** * @param page/*from w w w . j a v a 2s . com*/ * @see com.ecofactor.qa.automation.newapp.page.HelpOverlayPage#isSlideLoaded(com.ecofactor.qa.automation.newapp.enums.HelpPage) */ @Override public boolean isSlideLoaded(final HelpPage page, final String image) { Object bimage = null; final WebElement targetElement = getElement(getDriver(), By.cssSelector("div.help_slide_img"), TINY_TIMEOUT); bimage = targetElement.getAttribute("style"); return bimage.toString().contains(image); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.HelpOverlayPageImpl.java
License:Open Source License
/** * Reach the first page of helpOverLay page. * @return true, if drag and drop image displayed. * @see com.ecofactor.qa.automation.newapp.page.HelpOverlayPage#helpOverlayPageOne() */// w w w .j a v a 2s .c o m @Override public boolean helpOverlayPageOne() { setLogString("Verify the drag and drop image display.", true); Assert.assertTrue(isDisplayed(getDriver(), By.cssSelector(FIRSTIMAGE_HELP), TINY_TIMEOUT)); return true; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherOpsPageImpl.java
License:Open Source License
/** * Checks if is page loaded.//from w w w . ja v a 2s . c o m * @return true, if is page loaded * @see com.ecofactor.qa.automation.newapp.page.BasePage#isPageLoaded() */ @Override public boolean isPageLoaded() { LogUtil.setLogString("Verify the Location Switcher Pop up is loaded", true, CustomLogLevel.LOW); boolean isLoaded = isDisplayed(getDriver(), By.cssSelector(CLOSE_BTN), SHORT_TIMEOUT); LogUtil.setLogString( isLoaded ? "Location Switcher popup is opened" : "Location Switcher popup is not opened", true, CustomLogLevel.LOW); return isLoaded; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherOpsPageImpl.java
License:Open Source License
/** * Select tstat by id.//from ww w. j a v a2s .co m * @param tstatId the tstat id * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherOpsPage#selectTstatById(Integer) */ @Override public void selectTstatById(Integer tstatId) { LogUtil.setLogString("Select Thermostat", true, CustomLogLevel.HIGH); final WebElement tstatElement = getElementByAttr(getDriver(), By.cssSelector(THERMOSTAT_ROW), THERMOSTAT_ID, tstatId.toString(), SHORT_TIMEOUT); getAction().click(tstatElement); getAction().rejectAlert(); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherOpsPageImpl.java
License:Open Source License
/** * Click close.// w w w . j a v a 2 s . com * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherOpsPage#clickClose() */ @Override public void clickClose() { LogUtil.setLogString("Click Location Switcher Close Button", true, CustomLogLevel.HIGH); WebElement closeBtn = getElement(getDriver(), By.cssSelector(CLOSE_BTN), SHORT_TIMEOUT); getAction().click(closeBtn); getAction().rejectAlert(); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherOpsPageImpl.java
License:Open Source License
/** * Click location.// w w w . j av a2 s.c o m * @param locationName the location name * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherOpsPage#clickLocation(java.lang.String) */ @Override public void clickLocation(String locationName) { List<WebElement> rowList = getElements(getDriver(), By.cssSelector(LOCATION_ROW), SHORT_TIMEOUT); for (WebElement webElement : rowList) { if (webElement.getText().trim().equalsIgnoreCase(locationName.trim())) { getAction().click(webElement); getAction().rejectAlert(); break; } } }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Checks if is page loaded./*w w w .j a v a2 s. c o m*/ * @return true, if is page loaded * @see com.ecofactor.qa.automation.newapp.page.BasePage#isPageLoaded() */ @Override public boolean isPageLoaded() { LogUtil.setLogString("Verify the Location Switcher Page is loaded", true, CustomLogLevel.LOW); boolean isLoaded = isDisplayed(getDriver(), By.cssSelector(CLOSE_BTN), SHORT_TIMEOUT); if (isLoaded) { LogUtil.setLogString("Location Switcher page opened", true, CustomLogLevel.LOW); } return isLoaded; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the tstat name by id.//w w w .java 2s. c o m * @param tstatId the tstat id * @return the tstat name by id * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getTstatNameById(Integer) */ @Override public String getTstatNameById(final Integer tstatId) { LogUtil.setLogString("Get Thermostat Name for tstatId :" + tstatId, true, CustomLogLevel.LOW); final WebElement tstatElement = getElementByAttr(getDriver(), By.cssSelector(THERMOSTAT_ROW), THERMOSTAT_ID, tstatId.toString(), SHORT_TIMEOUT); final WebElement tstatNameElement = getElementBySubElement(getDriver(), tstatElement, By.className(THERMOSTAT_NAME), SHORT_TIMEOUT); return tstatNameElement.getText(); }