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

后端 未结 2 1985
[愿得一人]
[愿得一人] 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条回答
  •  旧时难觅i
    2020-11-22 05:08

    Try following XPath and let me know if problem still persist:

    //div[@id="avg_score_chart"]//*[name()="svg"]
    

    For elements:

    //div[@id="avg_score_chart"]//*[name()="svg"]/*[name()="g"]
    

    Update

    Finally, this should be nearly the best option:

    //div[@class="portlet light boxshadow"][contains(.,"Store Wise Performance")]/div//div[@class="amcharts-chart-div"]/*[name()="svg"]//*[name()="g"]/*[name()="path" and @fill="rgb(242,244,28)"]
    

提交回复
热议问题