How to click on SVG elements using XPath and Selenium WebDriver through Java

后端 未结 2 2023
[愿得一人]
[愿得一人] 2020-11-22 04:53

I have an SVG object with a few rectangle elements. Using geckodriver, I am trying to click on one of the main SVG object. However wit

2条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 05:18

    how about: //div[@id='avg_score_chart']//*[local-name()='svg']/*[*[local-name()='path']]

    where you find any element with a 'path' element inside an 'svg' element inside a 'div' element with id 'avg_score_chart'.

    Edit: placed the xpath in a code block

提交回复
热议问题