I just want to automate the chart action in Selenium? Web-driver/Java (Kendo Ui)
how can i click on the chart segments??
My graph is exactly same link in the below link
I just want to automate the chart action in Selenium? Web-driver/Java (Kendo Ui)
how can i click on the chart segments??
My graph is exactly same link in the below link
http://demos.telerik./kendo-ui/pie-charts/index
Share Improve this question asked May 5, 2015 at 10:31 Shanmuga RajShanmuga Raj 1251 gold badge2 silver badges16 bronze badges3 Answers
Reset to default 2ya i got the solution.... this is the code to drill down in chart
WebElement svg = gd.findElement(By.cssSelector("svg"));
List<WebElement> outertext = svg.findElements(By.cssSelector("text"));
for(WebElement texts : outertext)
{
String textcollection = texts.getText();
if(textcollection.equals("xxxxxx"))
{
texts.click();
}
}
Finding xpath of the elements inside the svg tag is bit different than finding xpath of other elements.
Suppose your URL is:
https://developers.google./chart/interactive/docs/gallery/piechart
If you have to find the text of the element in the pie-chart then you can use the code mentioned below:
driver.findElement(By.xpath(" //[@id='piechart']/div/div[1]/div/[name()='svg']/[name()='g'][4]/[name()='text']")).getText();
I have to automate a lot of pages that heavily use different controls of Kendo. I'm working at Telerik, and we are using Test Studio for our automation. However, you can apply our approach. I usually read the javascript API documentation for the control that I want to automate. There are tons of methods that can be executed for every one of them.
Example: http://docs.telerik./kendo-ui/api/javascript/kendo You just need to find the appropriate method for your case and execute it the javascript via Web driver:
WebDriver driver = new AnyDriverYouWant();
if (driver instanceof JavascriptExecutor) {
((JavascriptExecutor)driver).executeScript("yourScript();");
}
You can create extensions methods around the controls for these particular methods.
If you have questions, don't hesitate to contact me!