Problem to validate chart on website
- 9 years ago
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!