org.mozilla.zest.core.v1.ZestAssignFromElement.whereAttributeIs()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(82)

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

ZestAssignFromElement.whereAttributeIs介绍

暂无

代码示例

代码示例来源:origin: mozilla/zest

public ZestAssignFromElement whereAttributeIs(
    String attributeName, String attributeValueRegExp) {
  return whereAttributeIs(attributeName, attributeValueRegExp, 0);
}

代码示例来源:origin: mozilla/zest

@Test(expected = ZestAssignFailException.class)
public void invalidRegExShouldThrowAZestAssignFailException() throws Exception {
  // Given
  ZestAssignFromElement fromElement =
      new ZestAssignFromElement("Var")
          .whereAttributeIs("title", "[")
          .atIndex(0)
          .selectContent();
  // When
  assign(fromElement, testPageB);
  // Then = ZestAssignFailException
}

代码示例来源:origin: mozilla/zest

@Test
public void filterByValueIsStartingWithChoiceAndSelectContentOfSecondItem() throws Exception {
  // Given
  ZestAssignFromElement fromElement =
      new ZestAssignFromElement("Var")
          .whereAttributeIs("value", "Choice.*")
          .atIndex(1)
          .selectContent();
  // When
  String result = assign(fromElement, testPageB);
  // Then
  assertEquals("Choice 2", result);
}

代码示例来源:origin: mozilla/zest

@Test
public void filterByElementAndAttributeThenSelectTheFirstContent() throws Exception {
  // Given
  ZestAssignFromElement fromElement =
      new ZestAssignFromElement("Var")
          .whereElementIs("li")
          .whereAttributeIs("id", "2")
          .first()
          .selectContent();
  // When
  String result = assign(fromElement, testPageA);
  // Then
  assertEquals("Aliquam tincidunt mauris eu risus.", result);
}

相关文章