热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.openqa.selenium.support.ByIdOrName类的使用及代码示例

本文整理了Java中org.openqa.selenium.support.ByIdOrName类的一些代码示例,展示了ByIdOrName类

本文整理了Java中org.openqa.selenium.support.ByIdOrName类的一些代码示例,展示了ByIdOrName类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByIdOrName类的具体详情如下:
包路径:org.openqa.selenium.support.ByIdOrName
类名称:ByIdOrName

ByIdOrName介绍

暂无

代码示例

代码示例来源:origin: appium/java-client

@Override
public By buildBy() {
assertValidAnnotations();
By defaultBy = buildDefaultBy();
By mobileNativeBy = buildMobileNativeBy();
String idOrName = ((Field) annotatedElementContainer.getAnnotated()).getName();
if (defaultBy == null && mobileNativeBy == null) {
defaultBy =
new ByIdOrName(((Field) annotatedElementContainer.getAnnotated()).getName());
mobileNativeBy = new By.ById(idOrName);
return returnMappedBy(defaultBy, mobileNativeBy);
}
if (defaultBy == null) {
defaultBy =
new ByIdOrName(((Field) annotatedElementContainer.getAnnotated()).getName());
return returnMappedBy(defaultBy, mobileNativeBy);
}
if (mobileNativeBy == null) {
mobileNativeBy = defaultBy;
return returnMappedBy(defaultBy, mobileNativeBy);
}
return returnMappedBy(defaultBy, mobileNativeBy);
}

代码示例来源:origin: com.atlassian.jira/atlassian-jira-pageobjects

@Override
public By apply(@Nullable String from)
{
return new ByIdOrName(from);
}
},

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support

protected By buildByFromDefault() {
return new ByIdOrName(field.getName());
}

代码示例来源:origin: net.code-story/simplelenium

public static void injectMissingElements(Object pageObject) {
injectMissingPageObjects(pageObject);
injectNullFieldsOfType(DomElement.class, pageObject, field -> new LazyDomElement(new ByIdOrName(field.getName())));
injectNullFieldsWithConstructorParameterOfType(DomElement.class, pageObject, field -> new LazyDomElement(new ByIdOrName(field.getName())));
}

代码示例来源:origin: dgageot/simplelenium

public static void injectMissingElements(Object pageObject) {
injectMissingPageObjects(pageObject);
injectNullFieldsOfType(DomElement.class, pageObject, field -> new LazyDomElement(new ByIdOrName(field.getName())));
injectNullFieldsWithConstructorParameterOfType(DomElement.class, pageObject, field -> new LazyDomElement(new ByIdOrName(field.getName())));
}

代码示例来源:origin: stackoverflow.com

return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);

代码示例来源:origin: stackoverflow.com

private static class CustomFindByAnnotations extends Annotations {
protected By buildByFromLongFindBy(FindBy findBy) {
How how = findBy.how();
String using = findBy.using();
switch (how) {
case CLASS_NAME:
return By.className(using);
case ID:
return By.id(using); // By.name(using); in your case
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
}
}

代码示例来源:origin: paypal/SeLion

break;
valueToReturn = new ByIdOrName(seleniumLocator);

代码示例来源:origin: io.appium/java-client

@Override
public By buildBy() {
assertValidAnnotations();
By defaultBy = buildDefaultBy();
By mobileNativeBy = buildMobileNativeBy();
String idOrName = ((Field) annotatedElementContainer.getAnnotated()).getName();
if (defaultBy == null && mobileNativeBy == null) {
defaultBy =
new ByIdOrName(((Field) annotatedElementContainer.getAnnotated()).getName());
mobileNativeBy = new By.ById(idOrName);
return returnMappedBy(defaultBy, mobileNativeBy);
}
if (defaultBy == null) {
defaultBy =
new ByIdOrName(((Field) annotatedElementContainer.getAnnotated()).getName());
return returnMappedBy(defaultBy, mobileNativeBy);
}
if (mobileNativeBy == null) {
mobileNativeBy = defaultBy;
return returnMappedBy(defaultBy, mobileNativeBy);
}
return returnMappedBy(defaultBy, mobileNativeBy);
}

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support

public By buildBy() {
How how = How.ID_OR_NAME;
String using = field.getName();
FindBy findBy = field.getAnnotation(FindBy.class);
if (findBy != null) {
how = findBy.how();
using = findBy.using();
}
switch (how) {
case CLASS_NAME:
return By.className(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
throw new IllegalArgumentException("Cannot determine how to locate element");
}
}

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

private By getByFromHow(How how, String using) {
switch (how) {
case CLASS_NAME:
return By.className(using);
case CSS:
return By.cssSelector(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
// Note that this shouldn't happen (eg, the above matches all
// possible values for the How enum)
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
}

代码示例来源:origin: arachnidium/arachnidium-java

private static By getBy(How how, String using) {
switch (how) {
case CLASS_NAME:
return By.className(using);
case CSS:
return By.cssSelector(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
throw new IllegalArgumentException("Cannot determine how to locate element! Strategy is empty");
}
}

代码示例来源:origin: arquillian/arquillian-graphene

private By getByFromHow(How how, String using) {
switch (how) {
case CLASS_NAME:
return By.className(using);
case CSS:
return By.cssSelector(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
// Note that this shouldn't happen (eg, the above matches all
// possible values for the How enum)
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
}

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support

protected By buildByFromLongFindBy(FindBy findBy) {
How how = findBy.how();
String using = findBy.using();
switch (how) {
case CLASS_NAME:
return By.className(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
// Note that this shouldn't happen (eg, the above matches all
// possible values for the How enum)
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
}

代码示例来源:origin: arachnidium/arachnidium-java

private static By getBy(How how, String value){
switch (how) {
case CLASS_NAME:
return By.className(value);
case CSS:
return By.cssSelector(value);
case ID:
return By.id(value);
case LINK_TEXT:
return By.linkText(value);
case NAME:
return By.name(value);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(value);
case TAG_NAME:
return By.tagName(value);
case XPATH:
return By.xpath(value);
default:
return new ByIdOrName(value);
}
}

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

protected By buildByFromLongFindBy(FindBy findBy) {
How how = findBy.how();
String using = findBy.using();
switch (how) {
case CLASS_NAME:
return By.className(using);
case CSS:
return By.cssSelector(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
// Note that this shouldn't happen (eg, the above matches all
// possible values for the How enum)
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
}

代码示例来源:origin: arquillian/arquillian-graphene

protected By buildByFromLongFindBy(FindBy findBy) {
How how = findBy.how();
String using = findBy.using();
switch (how) {
case CLASS_NAME:
return By.className(using);
case CSS:
return By.cssSelector(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
// Note that this shouldn't happen (eg, the above matches all
// possible values for the How enum)
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
}

代码示例来源:origin: ru.yandex.qatools.actions/actions-beans

public static By buildByFromLongFindBy(FindBy findBy) {
How how = findBy.getHow();
String using = findBy.getUsing();
switch (how) {
case CLASS_NAME:
return By.className(using);
case CSS:
return By.cssSelector(using);
case ID:
return By.id(using);
case ID_OR_NAME:
return new ByIdOrName(using);
case LINK_TEXT:
return By.linkText(using);
case NAME:
return By.name(using);
case PARTIAL_LINK_TEXT:
return By.partialLinkText(using);
case TAG_NAME:
return By.tagName(using);
case XPATH:
return By.xpath(using);
default:
// Note that this shouldn't happen (eg, the above matches all
// possible values for the How enum)
throw new IllegalArgumentException("Cannot determine how to locate element " + findBy);
}
}

代码示例来源:origin: net.serenity-bdd/core

return new ByIdOrName(using);

代码示例来源:origin: net.serenity-bdd/serenity-core

return new ByIdOrName(using);

推荐阅读
author-avatar
燕阳阳消_469
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有