RE: Issue with SVG Element

I am having a button inside SVG element and xpath keeps on saying not found, how to click  the perticular path with selenium webdriver Kindly Help as i tried with various things like using uri by descendants::* it selects all the below elements but there are lot of elements in it so it is highly impossible to search from the hay of elements. Is there any way to select and click element through javascriptExecutor ?

Mrityunjay Default Asked on September 19, 2014 in Selenium WebDriver.
Add Comment
2 Answers

Hi Mrityunjay,

Please use the following code to identify the xpath of the needed object inside the SVG element.

/*[name()=’svg’]/*[name()=’SVG OBJECT’]

Use this code.

WebElement svgObject = driver.findElement(By.xpath(YOUR XPATH));
Actions builder = new Actions(driver);
builder.click(svgObject).build().perform();

Doctor Answered on September 19, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.