Problem to validate chart on website
Hi there,
I have test complete license for desktop.Right now, my team exploring test complete web. I'm using trial version to try out the web features and found one issue. we have a lots of chart and table need to validate. when i spy the chart, i found some data label on the chart cannot be captured by test complete. let say i have 13 bars on the chart, it only capture 1 bar as below picture. Do you have any suggestion to solve this issue?
Thanks: )
Hi nsag_1512,
You can access Highchart charts as follows:
// JScript/JavaScript var chart = pageObj.contentDocument.Script.Highcharts.chart[0]
(replace 0 with the chart index if there're several charts on the page.)
Then you can access all chart data via its options property. Use Chrome Dev Tools (F12 > Console) to find the properties and values you need.
Some useful properties:chartObj.options.title.text - chart title
chartObj.options.series - array of data serieschartObj.options.series[i].name - name of the series
chartObj.options.series[i].data - array of data points of the serieschartObj.options.xAsis.title.text - X axis title
chartObj.options.xAsis.categories - X axis labelsSee the Highcharts Options reference for a full list of available properties:
http://api.highcharts.com/highchartsDemo (using the http://www.highcharts.com/demo/line-basic page):
// JScript / JavaScript
function Test() { var url = "http://www.highcharts.com/demo/line-basic"; Browsers.Item(btChrome).Run(url); var page = Sys.Browser().Page(url); var chart = page.contentDocument.Script.Highcharts.charts[0]; // Log the series names and data points var series = chart.options.series; for (var i = 0; i < series.length; i++) { Log.Message(series[i].name + ": " + series[i].data.join(", ")); } }Hope this helps!