admin管理员组文章数量:1302270
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!
本文标签: javascriptHow to automate pie charts and bar graphs using seleniumStack Overflow
版权声明:本文标题:javascript - How to automate pie charts and bar graphs using selenium? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741706510a2393591.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论