--好的测试人员都会截得一手好图,就跟骨灰级宅男定会吟得一手好诗一般。
截取页面全图,不管页面有多长。
Java代码
package com.test;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Test_ShotScreen {
public static void main(String[] args) throws IOException, InterruptedException{
String url = "http://www.51.com";
//打开chrome
}
public static String getCurrentDateTime(){
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmmss");//设置日期格式
//System.out.println(df.format(new Date()));
return df.format(new Date());
}
}
--方法
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
public void takeScreenShot(String name){
}