Commit 52d67fab authored by 马博's avatar 马博

test

parent 57e0a8e9
......@@ -21,6 +21,8 @@ import ui.common.WebDriverType;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
......@@ -76,6 +78,7 @@ public class test {
}
@AfterMethod(alwaysRun = true)
public void afterMethod(ITestResult result) throws Exception {
if (!result.isSuccess())
......@@ -85,9 +88,16 @@ public class test {
File file = new File("C:/image");
Reporter.setCurrentTestResult(result);
Reporter.log(file.getAbsolutePath());
Reporter.log("<img src='" + "http://172.16.80.106" + "/" + result.getName() + ".jpg' hight='400' width='400'/>");
String time = String.valueOf(System.currentTimeMillis());
Reporter.log("<img src='" + "http://172.16.80.106" + "/" + result.getName() +"_"+time+ ".jpg' hight='600' width='600'/>");
File srcFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); //执行屏幕截取
FileUtils.copyFile(srcFile, new File(file.getAbsolutePath() + "/" + result.getName() + ".jpg"));
FileUtils.copyFile(srcFile, new File(file.getAbsolutePath() + "/" + result.getName() +"_"+time+ ".jpg"));
}
public static void main(String[] args) {
System.out.println(System.currentTimeMillis());
System.out.println(Calendar.getInstance().getTimeInMillis());
System.out.println(new Date().getTime());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment