if I have many path tag and I want to find specific tag like below example of code
< path d="a">
<path d="b">
<path d="c">
<path d="a">
how I can find elements have < path d ="a" > and click on it in selenium
CodePudding user response:
You can find the required path element using the below XPath.
//path[@d='a']
So for clicking the element you can use something like;
browser.find_element_by_xpath("//path[@d='a']").click()
CodePudding user response:
If the element is within svg
tag, the syntax of the Xpath would be
//*[local-name()='svg']
Or
//*[name()='svg']
The required Xpath for the shared HTML might be
//*[local-name()='svg']//*[local-name()='g']//*[local-name()='path' and @d='a']
If the above xpath does not work, share more HTML code.
Links to refer: