<div _ngcontent-c13="" class="canvas-container" style="width: 100%;"><div class="chartjs-size-monitor" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: hidden; pointer-events: none; visibility: hidden; z-index: -1;"><div class="chartjs-size-monitor-expand" style="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1;"><div style="position:absolute;width:1000000px;height:1000000px;left:0;top:0"></div></div><div class="chartjs-size-monitor-shrink" style="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1;"><div style="position:absolute;width:200%;height:200%;left:0; top:0"></div></div></div>
如何使用量角器识别此画布元素?
我也想读取此图表(画布元素中的甜甜圈图表)上的工具提示值。
答案 0 :(得分:0)
您没有太多选择。如果唯一,我会使用CSS:
var canvassElement = element(by.css(".chartjs-render-monitor"));
或标题:
var canvassElement = element(by.css("[title='Gender']"));
或xpath:
.//div[@title='Gender']
或
.//div[@class='chartjs-render-monitor']
或在dom上没有唯一性时同时使用两者:
.//div[@title='Gender'][@class='chartjs-render-monitor']