Back to Practice

SVG Elements

SVG Elements

SVG elements can be tricky to locate because they belong to a different XML namespace. Standard XPath `//svg` might fail in some older browsers/engines without `*[name()='svg']`.

Icon

Complex Group

QA Automation Helper

Target IDsKey Element IDs

#stage-1
#layer_1
#rect-1
#circle-1
#star-1

Advance Testing Tips

  • XPath Issue: Standard `//svg` often works, but `//*[local-name()='svg']` is the safest, standard-compliant way.
  • Within SVG: Use `//*[local-name()='rect'][@id='rect-1']` to find children.
  • Interaction: The click event works on SVG children just like normal DOM elements.