List of usage examples for org.openqa.selenium By toString
@Override
public String toString()
From source file:com.epam.jdi.uitests.mobile.appium.driver.WebDriverByUtils.java
License:Open Source License
public static By correctXPaths(By byValue) { return byValue.toString().contains("By.xpath: //") ? getByFunc(byValue).apply(getByLocator(byValue).replaceFirst("/", "./")) : byValue;/* ww w.ja v a2 s . co m*/ }
From source file:com.epam.jdi.uitests.mobile.appium.elements.BaseElement.java
License:Open Source License
public String printContext() { By locator; BaseElement parent;//from ww w . j av a 2 s .co m String parentContext; return getParent() == null || !isClass(getParent().getClass(), BaseElement.class) || (locator = (parent = (BaseElement) getParent()).getLocator()) == null ? "" : ((parentContext = parent.printContext()).equals("")) ? locator.toString() : locator + "; " + parentContext; }
From source file:com.epam.jdi.uitests.mobile.appium.elements.complex.table.Cell.java
License:Open Source License
public <T extends IBaseElement> T get(T cell) { BaseElement cellSelect = (BaseElement) cell; By locator = cellSelect.getLocator(); if (locator == null || locator.toString().equals("")) locator = cellLocatorTemplate;/*from www. j av a 2 s. c o m*/ if (!locator.toString().contains("{0}") || !locator.toString().contains("{1}")) throw exception("Can't create cell with locator template " + cellSelect.getLocator() + ". Template for Cell should contains '{0}' - for column and '{1}' - for row indexes."); cellSelect.setAvatar(new GetElementModule(fillByMsgTemplate(locator, columnIndex, rowIndex), cellSelect)); cellSelect.setParent(table); new AppiumCascadeInit().initElements(cellSelect, avatar.getDriverName()); return cell; }
From source file:com.epam.jdi.uitests.web.selenium.elements.complex.table.Cell.java
License:Open Source License
public <T extends IBaseElement> T get(T cell) { BaseElement cellSelect = (BaseElement) cell; if (cellSelect.getAvatar().hasWebElement()) return cell; By locator = cellSelect.getLocator(); if (locator == null || locator.toString().equals("")) locator = cellLocatorTemplate;/* w w w. j av a 2 s . co m*/ if (!locator.toString().contains("{0}") || !locator.toString().contains("{1}")) throw exception("Can't create cell with locator template " + cellSelect.getLocator() + ". Template for Cell should contains '{0}' - for column and '{1}' - for row indexes."); cellSelect.avatar.setDriverName(avatar.getDriverName()); cellSelect.init(table, new GetElementModule(fillByMsgTemplate(locator, columnIndex, rowIndex), cellSelect)); return cell; }
From source file:com.galenframework.components.mocks.driver.MockedDriver.java
License:Apache License
@Override public WebElement findElement(By by) { List<WebElement> elements = findElements(by); if (elements.size() > 0) { return elements.get(0); } else/*from w w w . j ava2 s . co m*/ throw new NoSuchElementException(by.toString()); }
From source file:com.galenframework.components.mocks.driver.MockedDriverElement.java
License:Apache License
@Override public WebElement findElement(By by) { if (item.getSubItems() != null) { for (MockedPageItem subItem : item.getSubItems()) { if (subItem.matches(by)) { return subItem.asWebElement(); }/*from w ww. ja v a 2s. com*/ } } throw new NoSuchElementException(by.toString()); }
From source file:com.ggasoftware.jdiuitest.web.selenium.driver.WebDriverByUtils.java
License:Open Source License
public static JFuncTT<String, By> getByFunc(By by) { return LinqUtils.first(getMapByTypes(), key -> by.toString().contains(key)); }
From source file:com.ggasoftware.jdiuitest.web.selenium.elements.apiInteract.GetElementModule.java
License:Open Source License
private Pairs<ContextType, By> correctXPaths(Pairs<ContextType, By> context) { if (context.size() == 1) return context; for (Pair<ContextType, By> pair : context.subList(1)) { By byValue = pair.value; if (byValue.toString().contains("By.xpath: //")) pair.value = getByFunc(byValue).invoke(getByLocator(byValue).replaceFirst("/", "./")); }/*from ww w . jav a 2 s. c o m*/ return context; }
From source file:com.ggasoftware.jdiuitest.web.selenium.elements.apiInteract.GetElementModule.java
License:Open Source License
private By correctXPaths(By byValue) { return (byValue.toString().contains("By.xpath: //")) ? getByFunc(byValue).invoke(getByLocator(byValue).replaceFirst("/", "./")) : byValue;//from w ww.j a va2 s. co m }
From source file:com.ggasoftware.jdiuitest.web.selenium.elements.complex.table.Cell.java
License:Open Source License
public <T extends BaseElement> T get(T cell) { By locator = cell.getLocator(); if (locator == null || locator.toString().equals("")) locator = cellLocatorTemplate;/*from w ww. j ava 2 s . c o m*/ if (!locator.toString().contains("{0}") || !locator.toString().contains("{1}")) throw exception("Can't create cell with locator template " + cell.getLocator() + ". Template for Cell should contains '{0}' - for column and '{1}' - for row indexes."); cell.getAvatar().byLocator = WebDriverByUtils.fillByMsgTemplate(locator, rowIndex, columnIndex); cell.getAvatar().context.add(ContextType.Locator, table.getLocator()); return cell; }