Need help for creating xpath for the SVG element

56 views
Skip to first unread message

anwesana kanungo

unread,
Sep 24, 2020, 3:02:23 AM9/24/20
to Selenium Users
Hi Team ,

Not able to select the element for the below SVG element . Any help is highly appreciated
<svg _ngcontent-c3="" class="fa fa-download header_download faa-wrench cursor cursor-test m-t-20" fill="#da6569" height="24" id="downloadData" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" ng-reflect-klass="fa fa-download header_download" ng-reflect-ng-class="[object Object]" xpathTest="1" xpath="1">
          <path _ngcontent-c3="" d="M0 0h24v24H0z" fill="none"></path>
          <path _ngcontent-c3="" d="M13 10h5l-6 6-6-6h5V3h2v7zm-9 9h16v-7h2v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-8h2v7z"></path>
        </svg>.

anwesana kanungo

unread,
Sep 24, 2020, 3:03:37 AM9/24/20
to Selenium Users
tried with below xapth : //*[local-name()='svg' and contains(@id,'downloadData')]//*[local-name()='path'][2] .Not working for me 

Arvind Sah

unread,
Sep 24, 2020, 1:48:12 PM9/24/20
to seleniu...@googlegroups.com
Try this
//*[name()='svg' and @id='downloadData']/path

Regards,
Arvind Sah

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b4f44f1e-ef43-45be-8053-783d1339e7f4n%40googlegroups.com.

madhav kumar

unread,
Sep 24, 2020, 3:04:18 PM9/24/20
to seleniu...@googlegroups.com
Please check with selectorshub.

--
Sent from my iPhone.

Adrian

unread,
Sep 25, 2020, 4:51:39 AM9/25/20
to Selenium Users
No XPath is required if you are using Selenium.
driver.FindElement(By.Id("downloadData"));

If XPath is required then try
//*[@id='downloadData']

Regards,
Adrian.
Reply all
Reply to author
Forward
0 new messages