2021-09-21 07:36:53 +03:00
< pre > < code class = "language-hurl" > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < span class = "method" > GET< / span > < span class = "url" > http://localhost:8000/assert-xpath< / span > < / span >
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP/1.0< / span > < span class = "number" > 200< / span > < / span >
< span class = "line section-header" > [Asserts]< / span >
2022-03-11 16:20:18 +03:00
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "normalize-space(//data)"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "café"< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "normalize-space(//data)"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "caf\u{00e9}"< / span > < / span >
2022-09-09 17:54:28 +03:00
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "normalize-space(//data)"< / span > < span class = "predicate-type" > > < / span > < span class = "string" > "CAFÉ"< / span > < / span >
2021-09-21 07:36:53 +03:00
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//toto"< / span > < span class = "not" > not< / span > < span class = "predicate-type" > exists< / span > < / span >
< span class = "line" > < / span >
< span class = "xml" > < span class = "line" > < data> café< /data> < / span > < / span >
2022-03-11 16:20:18 +03:00
< / span > < / span > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span >
< span class = "line" > < / span >
< span class = "line" > < / span > < span class = "comment" > # Test XPath assert with XML namespace.< / span >
< span class = "line" > < span class = "method" > GET< / span > < span class = "url" > http://localhost:8000/assert-xpath-simple-namespaces< / span > < / span >
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP/1.0< / span > < span class = "number" > 200< / span > < / span >
< span class = "line section-header" > [Asserts]< / span >
< span class = "line" > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//bk:book/bk:title)"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "Cheaper by the Dozen"< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//*[name()='bk:book']/*[name()='bk:title'])"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "Cheaper by the Dozen"< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//*[local-name()='book']/*[local-name()='title'])"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "Cheaper by the Dozen"< / span > < / span >
< span class = "line" > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//bk:book/isbn:number)"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "1568491379"< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//*[name()='bk:book']/*[name()='isbn:number'])"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "1568491379"< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//*[local-name()='book']/*[local-name()='number'])"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "1568491379"< / span > < / span >
< / span > < / span > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span >
< span class = "line" > < / span >
< span class = "line" > < / span > < span class = "comment" > # Test XPath assert with default XML namespace.< / span >
< span class = "line" > < / span > < span class = "comment" > # _ can be used to target a default namespace.< / span >
< span class = "line" > < span class = "method" > GET< / span > < span class = "url" > http://localhost:8000/assert-xpath-svg< / span > < / span >
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP/1.0< / span > < span class = "number" > 200< / span > < / span >
< span class = "line section-header" > [Asserts]< / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//_:svg/_:g/_:circle"< / span > < span class = "subquery-type" > count< / span > < span class = "predicate-type" > ==< / span > < span class = "number" > 3< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='circle']"< / span > < span class = "subquery-type" > count< / span > < span class = "predicate-type" > ==< / span > < span class = "number" > 3< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//*[name()='svg']/*[name()='g']/*[name()='circle']"< / span > < span class = "subquery-type" > count< / span > < span class = "predicate-type" > ==< / span > < span class = "number" > 3< / span > < / span >
< / span > < / span > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span >
< span class = "line" > < / span >
< span class = "line" > < / span > < span class = "comment" > # Test XPath assert with default and prefixed XML namespace.< / span >
< span class = "line" > < / span > < span class = "comment" > # _ can be used to target a default namespace.< / span >
< span class = "line" > < span class = "method" > GET< / span > < span class = "url" > http://localhost:8000/assert-xpath-namespaces< / span > < / span >
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP/1.0< / span > < span class = "number" > 200< / span > < / span >
< span class = "line section-header" > [Asserts]< / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//_:book/_:title)"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "Cheaper by the Dozen"< / span > < / span >
2022-09-09 17:54:28 +03:00
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//_:book/_:title)"< / span > < span class = "predicate-type" > > < / span > < span class = "string" > "Cheaper"< / span > < / span >
2022-03-11 16:20:18 +03:00
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "string(//_:book/isbn:number)"< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "1568491379"< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//*[name()='book']/*[name()='notes']"< / span > < span class = "subquery-type" > count< / span > < span class = "predicate-type" > ==< / span > < span class = "number" > 1< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//*[local-name()='book']/*[local-name()='notes']"< / span > < span class = "subquery-type" > count< / span > < span class = "predicate-type" > ==< / span > < span class = "number" > 1< / span > < / span >
< span class = "line" > < span class = "query-type" > xpath< / span > < span class = "string" > "//_:book/_:notes/*[local-name()='p']"< / span > < span class = "subquery-type" > count< / span > < span class = "predicate-type" > ==< / span > < span class = "number" > 1< / span > < / span >
< / span > < / span > < span class = "line" > < / span >
2022-10-24 12:37:11 +03:00
< / code > < / pre >