本文整理汇总了Java中org.openqa.selenium.logging.Logs.get方法的典型用法代码示例。如果您正苦于以下问题:Java Logs.get方法的具体用法?Java Logs.get怎么用?Java Logs.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.logging.Logs
的用法示例。
在下文中一共展示了Logs.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpLog
import org.openqa.selenium.logging.Logs; //导入方法依赖的package包/类
private void dumpLog() throws Exception {
Logs log = driver.manage().logs();
LogEntries entries = log.get(LogType.BROWSER);
// System.out.println(entries);
List<LogEntry> list = entries.getAll();
boolean fail = false;
for (int i = 0; i < list.size(); i++) {
LogEntry e = list.get(i);
System.out.println(e);
if (e.getLevel().getName().equals("SEVERE")
&& e.getMessage().indexOf("Uncaught ") != -1
&& e.getMessage().indexOf(" Error:") != -1) {
System.out.println("*** Uncaught Error ***");
fail = true;
}
}
if (fail) throw new Exception("Unhandled Exception! Check console log for details");
}
示例2: SeleniumTestResult
import org.openqa.selenium.logging.Logs; //导入方法依赖的package包/类
public SeleniumTestResult(WebDriver d, SeleniumTest test, Throwable cause, LoggingPreferences ___lp___) {
this.status = false;
this.internalTestRes = test.internalTestRs;
Logs logs = d.manage().logs();
for (String s : LOG_TYPES_SET) {
if(!logs.getAvailableLogTypes().contains(s))continue;
LogEntries logEntries = logs.get(s);
if(logEntries!=null && !logEntries.getAll().isEmpty()) {
this.logs.put(s, new SerializableLogEntries(logEntries.getAll()));
}
}
List<LogEntry> entries = new ArrayList<LogEntry>();
entries.add(new LogEntry(Level.ALL, new Date().getTime(), cause.getMessage()));
entries.add(new LogEntry(Level.ALL, new Date().getTime(), ExceptionUtils.getStackTrace(cause)));
this.logs.put("gatf", new SerializableLogEntries(entries));
}
示例3: SeleniumException
import org.openqa.selenium.logging.Logs; //导入方法依赖的package包/类
public SeleniumException(WebDriver d, Throwable cause, SeleniumTest test) {
super(cause);
Map<String, SerializableLogEntries> lg = new HashMap<String, SerializableLogEntries>();
Logs logs = d.manage().logs();
for (String s : d.manage().logs().getAvailableLogTypes()) {
LogEntries logEntries = logs.get(s);
if(!logEntries.getAll().isEmpty()) {
lg.put(s, new SerializableLogEntries(logEntries.getAll()));
}
}
List<LogEntry> entries = new ArrayList<LogEntry>();
entries.add(new LogEntry(Level.ALL, new Date().getTime(), cause.getMessage()));
entries.add(new LogEntry(Level.ALL, new Date().getTime(), ExceptionUtils.getStackTrace(cause)));
lg.put("gatf", new SerializableLogEntries(entries));
}
示例4: getSeleniumLog
import org.openqa.selenium.logging.Logs; //导入方法依赖的package包/类
@Override
public List<String> getSeleniumLog(Session session) {
List<String> result = new ArrayList();
Logs logs = session.getDriver().manage().logs();
for (String logType : logs.getAvailableLogTypes()) {
LogEntries logEntries = logs.get(logType);
result.add("********************" + logType + "********************\n");
for (LogEntry logEntry : logEntries) {
result.add(new Date(logEntry.getTimestamp()) + " : " + logEntry.getLevel() + " : " + logEntry.getMessage() + "\n");
}
}
return result;
}
示例5: clearlogs
import org.openqa.selenium.logging.Logs; //导入方法依赖的package包/类
public void clearlogs(String logType) {
Logs logs = manage().logs();
logs.get(logType);
}