使用phantom js
执行无头测试时,我收到了许多不必要的红色日志。
public class Utility
{
private static WebDriver driver=new PhantomJSDriver();
public static WebDriver getDriver()
{
return driver;
}
}
答案 0 :(得分:0)
以下是禁止INFO日志所需执行的操作:
File src = new File("C:\\Utility\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe");
System.setProperty("phantomjs.binary.path", src.getAbsolutePath());
DesiredCapabilities dcap = new DesiredCapabilities();
String[] phantomArgs = new String[] {
"--webdriver-loglevel=NONE"
};
dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs);
PhantomJSDriver driver = new PhantomJSDriver(dcap);
driver.get("https://www.facebook.com/");
让我知道它是否适合你。