我的Selenium脚本面临此错误......
我正在尝试生成我正在进行的测试的pdf证据,并且在运行我的脚本时我收到此错误
我的代码:
package test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.googlecode.seleniumjavaevidence.report.GenerateEvidenceReport;
import com.googlecode.seleniumjavaevidence.selenium.SeleniumEvidence;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;
public class NewTest {
WebDriver driver = new FirefoxDriver();
List<SeleniumEvidence> evidence ;
String exception ;
@BeforeTest
public void setUp() throws Exception {
driver.get("https://www.google.co.in");
}
@Test
public void testLogin() throws Exception {
try {
// driver.findElement(By.id("lst-ib"));
evidence.add(new SeleniumEvidence("get evidence from here",((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64)));
} catch (Exception e) {
evidence.add(new SeleniumEvidence("Unexpected error", ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64)));
exception = e.fillInStackTrace().getMessage();
} finally {
GenerateEvidenceReport.generatePDFEvidence(evidence, "null", null, null, exception);
}
}
}
答案 0 :(得分:0)
https://code.google.com/p/selenium-java-evidence/wiki/HowToUse?wl=pt-BR 似乎暗示:
如果您没有放置图像,将始终显示imageio.IOException 在代码的正确路径上。这不是问题所在 selenium-java-evidence ...修改你的代码并将所有图像放入 正确的道路。