本文整理汇总了Java中com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement类的典型用法代码示例。如果您正苦于以下问题:Java QAFExtendedWebElement类的具体用法?Java QAFExtendedWebElement怎么用?Java QAFExtendedWebElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QAFExtendedWebElement类属于com.qmetry.qaf.automation.ui.webdriver包,在下文中一共展示了QAFExtendedWebElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doubleClickElement
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
/**
* Performs the double touch gesture according to the point coordinates.
*
* @param locator write in format of x,y. can be in pixels or percentage(recommended) for example 50%,50%.
*/
@Then("^I double click on \"(.*?)\"")
public static void doubleClickElement(String locator) {
QAFExtendedWebElement myElement = new QAFExtendedWebElement(locator);
Point location = myElement.getLocation();
Dimension size = myElement.getSize();
// determine location to click and convert to an appropriate string
int xToClick = location.getX()+(size.getWidth()/2);
int yToClick = location.getY()+(size.getHeight()/2);
String clickLocation = xToClick + "," + yToClick;
DeviceUtils.doubleTouch(clickLocation);
}
示例2: fetchValue
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
public Object fetchValue(String loc, Type type,
Class<? extends QAFExtendedWebElement> eleClass) {
try {
WebElement ele = getElement(loc, eleClass);
switch (type) {
case optionbox :
return ele.getAttribute("value");
case checkbox :
return ele.isSelected();
case selectbox :
return new SelectBox(loc).getSelectedLable();
case multiselectbox :
return new SelectBox(loc).getSelectedLables();
default :
return ele.getText();
}
} catch (Exception e) {
logger.warn(e.getMessage());
return "";
}
}
示例3: getOptionElement
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
private QAFExtendedWebElement getOptionElement(String loc, String val,
Class<? extends QAFExtendedWebElement> eleClass) {
String optLoc;
if (!val.contains("=")) {
if (StringUtil.isNumeric(val)) {
optLoc = String.format(
".//option[@value='%s' or @lineNo=%s or @id='%s' or contains(.,'%s') ]",
val, val, val, val);
} else {
optLoc = String.format(
".//option[translate(.,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s' or translate(@value,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s' or translate(@id,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s']",
val.toUpperCase(), val.toUpperCase(), val.toUpperCase());
}
} else {
String[] parts = val.split("=", 2);
if (parts[0].equalsIgnoreCase("label") || parts[0].equalsIgnoreCase("text")) {
optLoc = String.format(".//option[contains(.,'%s')]", parts[1]);
} else if (parts[0].equalsIgnoreCase("lineNo")) {
optLoc = String.format(".//option[%d]", Integer.parseInt(parts[1]) + 1);
} else {
optLoc = String.format(".//option[@%s='%s']", parts[0], parts[1]);
}
}
return new QAFExtendedWebElement(getElement(loc, eleClass), By.xpath(optLoc));
}
示例4: verifyData
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
public boolean verifyData(B bean, int... index) {
Field[] flds = this.getClass().getDeclaredFields();
boolean outcome = true;
for (Field field : flds) {
String loc;
try {
loc = (String) field.get(this);
Object beanData = bean.getBeanData(loc);
if (beanData != null) {
outcome = interactor.verifyValue(String.format(loc, index), String.valueOf(bean.getBeanData(loc)),
getType(field), QAFExtendedWebElement.class);
}
} catch (Exception e) {
logger.warn("Unable to verify " + field.getName() + ": " + e.getMessage());
}
}
return outcome;
}
示例5: fetchUiData
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
private Object fetchUiData(Field field) {
try {
Method m = this.getClass().getDeclaredMethod("fetch" + StringUtil.getTitleCase(field.getName()));
m.setAccessible(true);
logger.debug("invoking custom fetch method for field " + field.getName());
return m.invoke(this);
} catch (Exception e) {
}
UiElement map = field.getAnnotation(UiElement.class);
if ((null == map)) {
return null;
}
Type type = map.fieldType();
String loc = map.fieldLoc();
Class<? extends QAFExtendedWebElement> eleClass = map.elementClass();
return interactor.fetchValue(loc, type,eleClass);
}
示例6: verifyUiData
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
private boolean verifyUiData(Field fld) {
UiElement map = fld.getAnnotation(UiElement.class);
Type type = map.fieldType();
String loc = map.fieldLoc();
String depends = map.dependsOnField();
String depVal = map.dependingValue();
Class<? extends QAFExtendedWebElement> eleClass = map.elementClass();
try {
if (StringUtil.isBlank(depends) || checkParent(depends, depVal)) {
return interactor.verifyValue(loc, String.valueOf(getBeanData(loc)), type,eleClass);
}
} catch (Exception e1) {
e1.printStackTrace();
return false;
}
// Skipped so just return success
return true;
}
示例7: afterCommand
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
@Override
public void afterCommand(QAFExtendedWebElement element, CommandTracker commandTracker) {
if (!StackTraceUtils.isWaitInvolved() && !isCommandExcludedFromLogging(commandTracker.getCommand())) {
LoggingBean bean;
try {
bean = new LoggingBean(commandTracker.getCommand(),
new String[] { element.toString(), new JSONObject(commandTracker.getParameters()).toString() },
null == commandTracker.getResponce() ? "OK"
: commandTracker.getCommand() + ":" + commandTracker.getResponce().getValue());
} catch (Exception e) {
bean = new LoggingBean(commandTracker.getCommand(), new String[] {}, "");
}
logDuration(commandTracker, bean);
commandLog.add(bean);
logger.info(bean.toString());
}
}
示例8: onFailure
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
@Override
public void onFailure(QAFExtendedWebElement element, CommandTracker commandTracker) {
LoggingBean bean;
try {
bean = new LoggingBean(commandTracker.getCommand(),
new String[] { element.toString(), new JSONObject(commandTracker.getParameters()).toString() },
commandTracker.getMessage());
} catch (Exception e) {
bean = new LoggingBean(commandTracker.getCommand(), new String[] {}, commandTracker.getMessage());
}
if (!isCommandExcludedFromLogging(commandTracker.getCommand())) {
logDuration(commandTracker, bean);
commandLog.add(bean);
}
logger.info(bean.toString());
}
示例9: findElements
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends QAFWebComponent> List<T> findElements(String loc, Class<T> t) {
List<QAFWebElement> eles = driver.findElements(loc);
List<T> objs = new ArrayList<T>();
for (QAFWebElement ele : eles) {
T obj = (T) ComponentFactory.getObject(t.getClass(), loc, this, driver);
obj.setId(((QAFExtendedWebElement) ele).getId());
try {
Field cacheable = obj.getClass().getDeclaredField("cacheable");
cacheable.setAccessible(true);
cacheable.set(obj, true);
} catch (Exception e) {
logger.error(e);
}
objs.add(obj);
}
return objs;
}
示例10: verifyValue
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
public boolean verifyValue(final String loc, final String val, final Type type,
Class<? extends QAFExtendedWebElement> eleClass) {
Object actualVal = null;
try {
actualVal = fetchValue(loc, type, eleClass);
boolean result = StringUtil.seleniumEquals(String.valueOf(actualVal), val);
report("value", result, val, actualVal);
return result;
} catch (Exception e) {
report("value", false, val, actualVal);
return false;
}
}
示例11: getElement
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
private QAFExtendedWebElement getElement(String loc,
Class<? extends QAFExtendedWebElement> eleClass) {
try {
Constructor<? extends QAFExtendedWebElement> con =
eleClass.getConstructor(String.class);
con.setAccessible(true);
QAFExtendedWebElement ele = con.newInstance(loc);
ele.waitForVisible();
return ele;
} catch (Exception e) {
throw new AutomationError(e);
}
}
示例12: check
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
public void check(String loc) {
QAFExtendedWebElement ele = new QAFExtendedWebElement(loc);
if (!ele.isSelected()) {
ele.click();
}
}
示例13: uncheck
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
public void uncheck(String loc) {
QAFExtendedWebElement ele = new QAFExtendedWebElement(loc);
if (ele.isSelected()) {
ele.click();
}
}
示例14: getStepProvider
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
@Override
protected Object getStepProvider() {
if (null != component) {
try {
Constructor<?> con = component.getDeclaredConstructor(String.class);
con.setAccessible(true);
return con.newInstance(loc);
} catch (Exception e) {
throw new StepInvocationException("Unable to initialize step: " + getDescription(), true);
}
}
return new QAFExtendedWebElement(loc);
}
示例15: beforeCommand
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; //导入依赖的package包/类
@Override
public void beforeCommand(QAFExtendedWebElement element, CommandTracker commandTracker) {
try {
logger.info("Executing " + commandTracker.getCommand() + " element: " + element.toString() + " parameters: "
+ new JSONObject(commandTracker.getParameters()).toString());
} catch (Exception e) {
logger.info("executing " + commandTracker.getCommand());
}
}