Home > Net >  Not able to click an path element using selenium webdriver
Not able to click an path element using selenium webdriver

Time:09-03

enter image description hereI am working on automating charts data and below is how the data is represented.

<path id="statdue" opacity="1" fill="#F15A22" stroke="transparent" stroke-width="0" stroke-dasharray="0" d="M 0 2.3749999999999916 Q… 0 2.3749999999999916 Z" aria-label="Overdue:0"> <path id="stat7days" opacity="1" fill="#1a1a1a" stroke="transparent" stroke-width="0" stroke-dasharray="0" d="M 0 49.87499999999998 Q …L 0 49.87499999999998 Z" aria-label="7 Days:3" style="visibility: visible;" transform="translate(0,0)">

I used the code:

driver.FindElement(By.CssSelector("#statdue")).Click();

But it was worked for driver.FindElement(By.CssSelector("#stat7days")).Click();

CodePudding user response:

I think you are going to need something like this for an xpath.

//*[name()='svg' and @id='statdue']")

  • Related