我正在使用 Selenide 和 Phantomjs 来测试 Web 应用程序。我截图如下:
byte[] bytes = ((TakesScreenshot)webDriver).getScreenshotAs(OutputType.BYTES);
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
returnImage = ImageIO.read(bis);
然而,对于输入元素,屏幕截图如下所示:故障截图
它实际上看起来像这样(使用 chrome/firefox 时) 它应该看起来如何
有趣的是,当我将 Selenide 设置为使用 phantomjs (Configuration.Browser = "phantomjs") 时,它会正确截取屏幕截图。它也只发生在那种元素上。按钮等记录良好。有任何想法吗?
PS:本文所附截图被裁剪,这里的代码截取了整个页面的截图。在我的代码中,我仅将屏幕截图裁剪为所需的元素,但即使在显示整个屏幕的屏幕截图上,该元素也没有正确记录。