DomMatchers

public final class DomMatchers
extends Object

java.lang.Object
   ↳ android.support.test.espresso.web.matcher.DomMatchers


org.w3c.dom包中的对象的一组hamcrest匹配器(如 DocumentElement )。

Summary

Public methods

static Matcher<Document> containingTextInBody(String text)

返回匹配具有包含给定测试的主体的文档的匹配器。

static Matcher<Document> elementById(String id, Matcher<Element> elementMatcher)

匹配 Document ,该匹配 Element具有与给定元素匹配器相匹配的给定ID。

static Matcher<Document> elementByXPath(String xpath, Matcher<Element> elementMatcher)

匹配一个XPath,并根据它在 Element中找到的第一个 Element进行 NodeList

static Matcher<Document> hasElementWithId(String id)

返回匹配 Document的匹配器,它至少包含一个具有给定ID的元素。

static Matcher<Document> hasElementWithXpath(String xpath)

返回匹配 Document的匹配器,它至少包含一个元素与给定的xpath。

static Matcher<Document> withBody(Matcher<Element> bodyMatcher)

返回匹配 Document与匹配给定匹配器的正文的匹配器。

static Matcher<Element> withTextContent(String textContent)

返回匹配 Element与给定textContent的匹配器。

static Matcher<Element> withTextContent(Matcher<String> textContentMatcher)

返回匹配匹配给定匹配器的textContent的匹配器 Element

Inherited methods

From class java.lang.Object

Public methods

containingTextInBody

Matcher<Document> containingTextInBody (String text)

返回匹配具有包含给定测试的主体的文档的匹配器。

Parameters
text String
Returns
Matcher<Document>

elementById

Matcher<Document> elementById (String id, 
                Matcher<Element> elementMatcher)

匹配 Document ,其中 Element与给定的id匹配给定的元素匹配器。

Parameters
id String
elementMatcher Matcher
Returns
Matcher<Document>

elementByXPath

Matcher<Document> elementByXPath (String xpath, 
                Matcher<Element> elementMatcher)

匹配一个XPath并对照它在 Element中找到的第一个 Element进行 NodeList

Parameters
xpath String
elementMatcher Matcher
Returns
Matcher<Document>

hasElementWithId

Matcher<Document> hasElementWithId (String id)

返回匹配 Document的匹配器,该匹配器至少有一个具有给定ID的元素。

Parameters
id String
Returns
Matcher<Document>

hasElementWithXpath

Matcher<Document> hasElementWithXpath (String xpath)

返回匹配 Document的匹配器,它至少包含一个元素和给定的xpath。

Parameters
xpath String
Returns
Matcher<Document>

withBody

Matcher<Document> withBody (Matcher<Element> bodyMatcher)

返回一个与匹配给定匹配器的正文匹配的匹配器 Document

Parameters
bodyMatcher Matcher
Returns
Matcher<Document>

withTextContent

Matcher<Element> withTextContent (String textContent)

返回匹配Element与给定textContent的匹配器。 withTextContent(等于(textContent))。

Parameters
textContent String
Returns
Matcher<Element>

withTextContent

Matcher<Element> withTextContent (Matcher<String> textContentMatcher)

返回匹配匹配给定匹配器的textContent的匹配器 Element

Parameters
textContentMatcher Matcher
Returns
Matcher<Element>