2020-08-27 10:07:46 +03:00
|
|
|
GET http://localhost:8000/assert-xpath
|
|
|
|
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2020-08-27 10:07:46 +03:00
|
|
|
[Asserts]
|
2022-03-11 16:20:18 +03:00
|
|
|
xpath "normalize-space(//data)" == "café"
|
|
|
|
xpath "normalize-space(//data)" == "caf\u{00e9}"
|
2022-09-09 17:54:28 +03:00
|
|
|
xpath "normalize-space(//data)" > "CAFÉ"
|
2020-08-27 10:07:46 +03:00
|
|
|
xpath "//toto" not exists
|
|
|
|
|
|
|
|
<data>café</data>
|
2022-03-11 16:20:18 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Test XPath assert with XML namespace.
|
|
|
|
GET http://localhost:8000/assert-xpath-simple-namespaces
|
|
|
|
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2022-03-11 16:20:18 +03:00
|
|
|
[Asserts]
|
|
|
|
|
|
|
|
xpath "string(//bk:book/bk:title)" == "Cheaper by the Dozen"
|
|
|
|
xpath "string(//*[name()='bk:book']/*[name()='bk:title'])" == "Cheaper by the Dozen"
|
|
|
|
xpath "string(//*[local-name()='book']/*[local-name()='title'])" == "Cheaper by the Dozen"
|
|
|
|
|
|
|
|
xpath "string(//bk:book/isbn:number)" == "1568491379"
|
|
|
|
xpath "string(//*[name()='bk:book']/*[name()='isbn:number'])" == "1568491379"
|
|
|
|
xpath "string(//*[local-name()='book']/*[local-name()='number'])" == "1568491379"
|
|
|
|
|
|
|
|
|
|
|
|
# Test XPath assert with default XML namespace.
|
|
|
|
# _ can be used to target a default namespace.
|
|
|
|
GET http://localhost:8000/assert-xpath-svg
|
|
|
|
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2022-03-11 16:20:18 +03:00
|
|
|
[Asserts]
|
|
|
|
xpath "//_:svg/_:g/_:circle" count == 3
|
2023-06-01 10:24:52 +03:00
|
|
|
xpath "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='circle']" count == 3
|
2022-03-11 16:20:18 +03:00
|
|
|
xpath "//*[name()='svg']/*[name()='g']/*[name()='circle']" count == 3
|
|
|
|
|
|
|
|
|
|
|
|
# Test XPath assert with default and prefixed XML namespace.
|
|
|
|
# _ can be used to target a default namespace.
|
|
|
|
GET http://localhost:8000/assert-xpath-namespaces
|
|
|
|
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2022-03-11 16:20:18 +03:00
|
|
|
[Asserts]
|
|
|
|
xpath "string(//_:book/_:title)" == "Cheaper by the Dozen"
|
2022-09-09 17:54:28 +03:00
|
|
|
xpath "string(//_:book/_:title)" > "Cheaper"
|
2022-03-11 16:20:18 +03:00
|
|
|
xpath "string(//_:book/isbn:number)" == "1568491379"
|
|
|
|
xpath "//*[name()='book']/*[name()='notes']" count == 1
|
|
|
|
xpath "//*[local-name()='book']/*[local-name()='notes']" count == 1
|
|
|
|
xpath "//_:book/_:notes/*[local-name()='p']" count == 1
|
|
|
|
|