Forum Discussion

nsag_1512's avatar
nsag_1512
Occasional Contributor
9 years ago

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...
  • HKosova's avatar
    HKosova
    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 series

    chartObj.options.series[i].name - name of the series
    chartObj.options.series[i].data - array of data points of the series

    chartObj.options.xAsis.title.text - X axis title
    chartObj.options.xAsis.categories - X axis labels

     

    See the Highcharts Options reference for a full list of available properties:
    http://api.highcharts.com/highcharts

     

    Demo (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!