Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从FirefoxDriver和HtmlUnitDriver获取的渲染SVG的差异_Javascript_Svg_Selenium Webdriver_Highcharts - Fatal编程技术网

Javascript 从FirefoxDriver和HtmlUnitDriver获取的渲染SVG的差异

Javascript 从FirefoxDriver和HtmlUnitDriver获取的渲染SVG的差异,javascript,svg,selenium-webdriver,highcharts,Javascript,Svg,Selenium Webdriver,Highcharts,我正在使用JQuery 1.8和Highcharts 4.1.9在HTML文件中使用以下代码创建highchart图形 <div id="JSGraphContainer" class="GraphContainerJS" "></div> <script> $(function() { var line; var plotList= [];

我正在使用JQuery 1.8和Highcharts 4.1.9在HTML文件中使用以下代码创建highchart图形

<div id="JSGraphContainer" class="GraphContainerJS" "></div>
<script>
        $(function() {
                    var line;
                    var plotList= [];
                    data = {"vals": [['1244246400000', 11],
                                      ['1244332800000', 22],
                                      ['1244419200000', 11],
                                      ['1244505600000', 22],
                                      ['1244592000000', 33],
                                      ['1244678400000', 11],
                                      ['1244764800000', 22]
                                    ]};
                    $("#JSGraphContainer").highcharts({
                        chart: {
                            type: 'line',
                            zoomType: "x",
                            plotBorderWidth: 1,
                            plotBorderColor: 'black',
                        },
                        title: {text: null},
                        xAxis: {
                            crosshair: true,
                            type: 'datetime',
                            opposite: true,
                            tickmarkPlacement: "on",
                            gridLineDashStyle: "Dash",
                            gridLineWidth: 1,
                            tickWidth : 0,
                            plotLines: plotList,
                        },
                        yAxis: {
                            title: { text: null },
                            tickAmount: 5,
                            gridLineDashStyle: "Dash",
                            opposite: false
                        },
                        series: [{  data: data.vals  }],
                        plotOptions: {
                            series: {
                                marker: {
                                    enabled: true
                                }
                            }
                        },
                        legend: {enabled : false},
                        tooltip: {
                            formatterdd: function() {
                                return ((new Date(this.x)).toDateString()) + ", " + this.y;
                            },
                            pointFormat: '<span style="color:{point.color}">\u25CF</span><b>{point.y}</b><br/>',
                            crosshairs: {
                                color: 'green',
                                dashStyle: 'solid'
                            }
                        }
                    });
                }); 
              </script>
当我使用FirefoxDriver时,我会将正确的SVG打印到sysout,但当我使用启用JavaScript的HTMLUnitDriver时,我会得到不同的SVG输出,它与firefox不匹配,并且在html文件上复制时不会呈现任何内容。我尝试将firefox功能用作

new HtmlLUnitDriver(DesiredCapabilities.firefox());
但这没用。我希望一定有办法配置HtmlUnitDriver,如果有的话,以获得正确的输出


感谢你的指点

在highcharts中已经有一个名为getSVG的方法可以使用

 svg = chart.getSVG()
       .replace(/</g, '\n&lt;')  
       .replace(/>/g, '&gt;');

highcharts中已经有一个名为getSVG的方法可以使用。您是否尝试禁用所有动画?另外,FirefoxDriver支持SVG吗?还有,你有什么错误吗?你试过使用非常简单的图表吗?如下:$JSGraphContainer.highcharts{series:[{data:[10,20]}]};。如何禁用所有动画?你在学习css3方法吗?FirefoxDriver确实支持SVG,并提供与在浏览器上呈现的内容相同的SVG。因为HtmlUnitDriver是无头的,所以我看不到任何东西,也看不到任何错误。就在svg printed通过将其包含在html标记中再次呈现在任何其他浏览器上时,它显示的是带有Highcharts.com水印的空白画布。svg输出中的差异问题仍然存在。在firefox上运行脚本提供的SVG内容与使用HtmlUnitDriver生成的内容不同。
 svg = chart.getSVG()
       .replace(/</g, '\n&lt;')  
       .replace(/>/g, '&gt;');