/** * After the tab is set to active * * @return true or false */ @Override public boolean setActive() { boolean activated = isActive(); if (!activated) { WebLocator locator1 = new WebLocator(getPathBuilder().getContainer()).withElxPath(getTitlePath(false)); WebLocator titleElement = locator1.withInfoMessage(getPathBuilder().getText() + " Tab"); activated = titleElement.click(); } if (activated) { LOGGER.info("setActive : " + toString()); } return activated; }
public void selectAll() { invoiceMenuItem.mouseOver(); invoicesListItem.assertClick(); WebLocator waiting = new WebLocator().setText("Se încarcă..."); ConditionManager conditionManager = new ConditionManager().add(new ElementRemovedSuccessCondition(waiting)); Condition condition = conditionManager.execute(); closePromo.click(); if (seeInvoices.isElementPresent()) { seeInvoices.assertClick(); } closePromo.click(); selectAllButton.assertClick(); }
public static void init(WebDriver driver) { if (driver != null) { LOGGER.info("==============================================================="); LOGGER.info("| Open Selenium Web Driver "); LOGGER.info("===============================================================\n"); WebDriverConfig.driver = driver; WebLocator.setDriverExecutor(driver); if (driver instanceof InternetExplorerDriver) { isIE = true; } else if (driver instanceof ChromeDriver) { isChrome = true; } else if (driver instanceof FirefoxDriver) { isFireFox = true; } else if (driver instanceof SafariDriver) { isSafari = true; } else if (driver instanceof OperaDesktopDriver) { isOpera = true; } driver.manage().window().maximize(); driver .manage() .timeouts() .implicitlyWait(WebLocatorConfig.getInt("driver.implicitlyWait"), TimeUnit.MILLISECONDS); Runtime.getRuntime() .addShutdownHook( new Thread() { public void run() { if (WebLocatorConfig.getBoolean("driver.autoClose")) { initSeleniumEnd(); } } }); } }
public void successfullyPaid() { successMessageElement.assertReady(); }
public void switchToPopup() { WebLocator popup = new WebLocator().setClasses("popup"); WebLocator iframe = new WebLocator(popup).setTag("iframe"); iframe.assertReady(); WebDriverConfig.getDriver().switchTo().frame(iframe.currentElement); }
private String getTitlePath(boolean active) { WebLink link = new WebLink().withText(getPathBuilder().getText(), SearchType.EQUALS); String isActive = active ? "@class='active'" : "not(@class='active')"; WebLocator el = new WebLocator().withTag("ul").withClasses(getPathBuilder().getBaseCls()); return el.getXPath() + "//li[" + isActive + "]" + link.getXPath(); }