量角器单击功能不适用于Firefox中的图表,但在chrome中可以正常使用

时间:2019-02-20 04:12:18

标签: javascript firefox testing automation protractor

我使用量角器对仪表板进行自动化测试,其中包括高车图形,单击该图形可以弹出详细的窗口。在这种情况下,click()在Firefox的图表中不起作用,但是它跳到了在详细窗口中搜索内容的下一个步骤,并抛出一条错误消息:“ Expected false to equal true”,而不是引发click()异常。

以下是我尝试使click()起作用的一些方法,它们都不符合Firefox的预期效果,但是它们对于chrome都可以正常工作。

1.    browser.executeScript("arguments[0].click();", element.getWebElement());

2.    browser.executeScript('arguments[0].scrollIntoView(true)',element.getWebElement());

3.    global.waitAndClick = function(element, time, errMessage) {
        if(typeof(time) ==='undefined') time = 10000;
        var IsClickable = EC.elementToBeClickable(element);
        browser.wait(IsClickable, time, errMessage);
        return element.click();
      };

在第三种情况下,我尝试添加wait(),它用作Checkable元素的检查,如果它不可单击,则应引发异常。

尝试同时使用xpath和元素id

1.    element = element(by.xpath("/html/body/app-root/main/div/app-dash-route/section[2]/app-dash/div[2]/div[3]/app-widget/div/div[2]/app-attack-status-overview/chart/div//*[@class='highcharts-root']//*[@class='highcharts-series-group']//*[@class='highcharts-point highcharts-color-1']")) 
      element.click();

2.    widgetseriesgroup = element(by.tagName(app-attack-status-overview)).element(by.tagName('svg')).element(by.css('g.highcharts-series-group'));
      widgetseries = widgetseriesgroup.all(by.css('g.highcharts-series-0')).get(0);
      element = widgetseries.all(by.tagName('path')).get(1);
      element.click();

附带html文件

<app-attack-status-overview _nghost-c15="" style="height: 220px;"><div _ngcontent-c15="" class="filters"><div _ngcontent-c15="" class="d-inline-block case-type-drop dropdown" ngbdropdown="" placement="bottom-right"><label _ngcontent-c15="" class="label-text mr5" for="caseTypeDropAttackStatusOverview">Case Type:</label><a _ngcontent-c15="" aria-haspopup="true" class="btn case-type-drop-val dropdown-toggle" href="javascript:void(0);" id="caseTypeDropAttackStatusOverview" ngbdropdowntoggle="" aria-expanded="false"> All </a><div _ngcontent-c15="" aria-labelledby="caseTypeDropAttackStatusOverview" class="case-type-drop-menu dropdown-menu" ngbdropdownmenu="" x-placement="bottom-right"><!----><a _ngcontent-c15="" class="dropdown-item">All</a><a _ngcontent-c15="" class="dropdown-item">Phishing</a><a _ngcontent-c15="" class="dropdown-item">Trojan</a><a _ngcontent-c15="" class="dropdown-item">Brand Abuse</a><a _ngcontent-c15="" class="dropdown-item">Advance Fee Fraud</a><a _ngcontent-c15="" class="dropdown-item">Vishing</a></div></div></div><chart _ngcontent-c15="" style="overflow: hidden;" data-highcharts-chart="19"><div id="highcharts-s53tmoq-579" dir="ltr" class="highcharts-container " style="position: relative; overflow: hidden; width: 282px; height: 220px; text-align: left; line-height: normal; z-index: 0; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: Montserrat, &quot;Open Sans&quot;, sans-serif;"><svg version="1.1" class="highcharts-root" style="font-family:'Montserrat','Open Sans', sans-serif;font-size:12px;" xmlns="http://www.w3.org/2000/svg" width="282" height="220" viewBox="0 0 282 220"><desc>Created with Highcharts 7.0.1</desc><defs><clipPath id="highcharts-s53tmoq-582"><rect x="0" y="0" width="272" height="210" fill="none"></rect></clipPath></defs><rect fill="#283137" class="highcharts-background" x="0" y="0" width="282" height="220" rx="0" ry="0"></rect><rect fill="none" class="highcharts-plot-background" x="5" y="5" width="272" height="210"></rect><rect fill="none" class="highcharts-plot-border" data-z-index="1" x="5" y="5" width="272" height="210"></rect><g class="highcharts-series-group" data-z-index="3"><g data-z-index="0.1" class="highcharts-series highcharts-series-0 highcharts-pie-series highcharts-tracker " transform="translate(5,5) scale(1 1)" style="cursor:pointer;"><path fill="#E85163" d="M 135.98065104564895 10.000001970431782 A 95 95 0 0 1 152.3340816056507 11.414756622104449 L 151.02735507719865 18.901576092336086 A 87.4 87.4 0 0 0 135.98219896199703 17.60000181279723 Z" transform="translate(0,0)" stroke="#283137" stroke-width="1" stroke-linejoin="round" class="highcharts-point highcharts-color-0"></path><path fill="#22E6BE" d="M 152.42765866639093 11.431137493605547 A 95 95 0 1 1 135.8680469058832 10.000091640144447 L 135.87860315341254 17.60008430893288 A 87.4 87.4 0 1 0 151.11344597307965 18.916646494117103 Z" transform="translate(0,0)" stroke="#283137" stroke-width="1" stroke-linejoin="round" class="highcharts-point highcharts-color-1"></path></g><g data-z-index="0.1" class="highcharts-markers highcharts-series-0 highcharts-pie-series " transform="translate(5,5) scale(1 1)"></g></g><text x="141" text-anchor="middle" class="highcharts-title" data-z-index="4" style="color:#333333;font-size:18px;fill:#333333;" y="24"></text><text x="141" text-anchor="middle" class="highcharts-subtitle" data-z-index="4" style="color:#666666;fill:#666666;" y="24"></text><g class="highcharts-legend" data-z-index="7"><rect fill="none" class="highcharts-legend-box" rx="0" ry="0" x="0" y="0" width="8" height="8" visibility="hidden"></rect><g data-z-index="1"><g></g></g></g><g class="highcharts-label highcharts-tooltip highcharts-color-1" style="pointer-events:none;white-space:nowrap;" data-z-index="8" transform="translate(6,-9999)" opacity="0" visibility="visible"><path fill="none" class="highcharts-label-box highcharts-tooltip-box highcharts-shadow" d="M 3.5 0.5 L 158.5 0.5 C 161.5 0.5 161.5 0.5 161.5 3.5 L 161.5 42.5 C 161.5 45.5 161.5 45.5 158.5 45.5 L 3.5 45.5 C 0.5 45.5 0.5 45.5 0.5 42.5 L 0.5 3.5 C 0.5 0.5 0.5 0.5 3.5 0.5" stroke="#000000" stroke-opacity="0.049999999999999996" stroke-width="5" transform="translate(1, 1)"></path><path fill="none" class="highcharts-label-box highcharts-tooltip-box highcharts-shadow" d="M 3.5 0.5 L 158.5 0.5 C 161.5 0.5 161.5 0.5 161.5 3.5 L 161.5 42.5 C 161.5 45.5 161.5 45.5 158.5 45.5 L 3.5 45.5 C 0.5 45.5 0.5 45.5 0.5 42.5 L 0.5 3.5 C 0.5 0.5 0.5 0.5 3.5 0.5" stroke="#000000" stroke-opacity="0.09999999999999999" stroke-width="3" transform="translate(1, 1)"></path><path fill="none" class="highcharts-label-box highcharts-tooltip-box highcharts-shadow" d="M 3.5 0.5 L 158.5 0.5 C 161.5 0.5 161.5 0.5 161.5 3.5 L 161.5 42.5 C 161.5 45.5 161.5 45.5 158.5 45.5 L 3.5 45.5 C 0.5 45.5 0.5 45.5 0.5 42.5 L 0.5 3.5 C 0.5 0.5 0.5 0.5 3.5 0.5" stroke="#000000" stroke-opacity="0.15" stroke-width="1" transform="translate(1, 1)"></path><path fill="#282F35" class="highcharts-label-box highcharts-tooltip-box" d="M 3.5 0.5 L 158.5 0.5 C 161.5 0.5 161.5 0.5 161.5 3.5 L 161.5 42.5 C 161.5 45.5 161.5 45.5 158.5 45.5 L 3.5 45.5 C 0.5 45.5 0.5 45.5 0.5 42.5 L 0.5 3.5 C 0.5 0.5 0.5 0.5 3.5 0.5" stroke="#22E6BE" stroke-width="1"></path><text x="15" data-z-index="1" style="font-size:12px;color:#AEBCC9;cursor:default;fill:#AEBCC9;" y="27"><tspan>Offline Attacks: </tspan><tspan style="font-weight:bold" dx="0">4,252</tspan></text></g></svg></div></chart></app-attack-status-overview>

此问题的任何原因仅出现在firefox中吗?

谢谢

0 个答案:

没有答案