代码之家  ›  专栏  ›  技术社区  ›  Matthew Strom

Phantomjs浏览器在夜视测试中错误地计算了css calc()函数

  •  0
  • Matthew Strom  · 技术社区  · 7 年前

    我正在为功能前端构建夜视测试(使用Phantomjs),我的任务之一是确保横幅图像的高度是动态的,并且根据屏幕大小正确计算其高度。

    我有一些页面元素看起来像这样:

    //html
    <div class="bannerImg"></div>
    
    //css
    .bannerImg {
        background-image: url('someImgUrl');
        height: calc(100vh - 200); //some calculation here
        min-height: 600px; //some minimum height
    }
    

    例如,1080视口的高度应为880px。

    然而,当我运行测试时,Nightwatch报告元素的大小为600px(基本上为600)。

    根据我对此的研究,其他人在使用calc()和Phantom进行测试时遇到了其他/类似的困难。js浏览器 https://github.com/ariya/phantomjs/issues/13547

    是否有计划增加对该功能的支持?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Vaviloff    7 年前

    PhantomJS不再处于活动开发中,如果可能的话,您应该迁移到 puppeteer 它的灵感来源于幻影。