截图在selenium webdriver

时间:2016-07-26 14:02:44

标签: selenium

我正在尝试在运行selenium脚本时捕获屏幕截图。但我得到低于错误。有人帮我解决这个问题。

  

java.lang.ArrayIndexOutOfBoundsException:123 at   org.openqa.selenium.internal.Base64Encoder.mapCharToInt(Base64Encoder.java:89)     在   org.openqa.selenium.internal.Base64Encoder.decode(Base64Encoder.java:76)     在   org.openqa.selenium.OutputType $ 2.convertFromBase64Png(OutputType.java:57)     在   org.openqa.selenium.OutputType $ 2.convertFromBase64Png(OutputType.java:1)     在   org.openqa.selenium.OutputType $ 3.convertFromBase64Png(OutputType.java:75)     在   org.openqa.selenium.OutputType $ 3.convertFromBase64Png(OutputType.java:1)     在   org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:339)

使用下面的代码,

File scrFile = ( (TakesScreenshot) driver ).getScreenshotAs( OutputType.FILE );     
            nextVal = seq.incrementAndGet();
            FileUtils.copyFile( scrFile, new File( "./Screenshots/Sanity/" + nextVal + ".png" ) ); 

1 个答案:

答案 0 :(得分:0)

Issue got fixed after updated my selenium webdriver jar and Chromedriver[2.23] to latest version. Now we are able to capture screenshot without any issues while running.