【发布时间】:2015-05-12 13:27:08
【问题描述】:
我尝试在java中隐藏控制台和GhostDriver的日志...
- Windows 7.
- JDK is in 1.7.0_75 version.
- PhantomJS 1.9.7 is include with it path.
- GhostDriver 1.1.0 is include in an Eclipse Java SE Project.
- Selenium 2.43.1 is include in an Eclipse Java SE Project.
有办法吗?
我在 cli_args 中尝试了“--webdriver-loglevel=OFF”和“--webdriver-loglevel=NONE”,但它不起作用...
我试过 java -jar myJar.jar > myFile.txt 但它不起作用...
还有其他方法还是可能出错?
代码示例:
WebDriver driver;
DesiredCapabilities dCaps;
dCaps = new DesiredCapabilities();
dCaps.setJavascriptEnabled(true);
dCaps.setCapability("takesScreenshot", true);
dCaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] {"--ignore-ssl-errors=true", "--ssl-protocol=tlsv1", "--web-security=false", "--webdriver-loglevel=OFF", "--webdriver-loglevel=NONE"});
dCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantom);
driver = new PhantomJSDriver(dCaps);
还有日志(带有虚拟机参数):
mai 18, 2015 2:09:48 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFOS: executable: C:\Users\212428788\workspace\BigBrowser\phantomjs-1.9.7-windows\phantomjs.exe
mai 18, 2015 2:09:48 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFOS: port: 48921
mai 18, 2015 2:09:48 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFOS: arguments: [--ignore-ssl-errors=true, --ssl-protocol=tlsv1, --web-security=false, --webdriver-loglevel=OFF, --webdriver-loglevel=NONE, --webdriver=48921, --webdriver-logfile=C:\Users\212428788\workspace\BigBrowser\phantomjsdriver.log]
mai 18, 2015 2:09:48 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFOS: environment: {}
PhantomJS is launching GhostDriver...
非常感谢。
【问题讨论】:
-
您可以尝试在eclipse中添加VM参数并检查吗?从您的日志中,我可以看到其中一半已被静音。
-
我做了并编辑了它
标签: java selenium phantomjs ghostdriver