当前位置: 首页>>代码示例>>Java>>正文


Java Logs.get方法代码示例

本文整理汇总了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");		
}
 
开发者ID:redskyit,项目名称:ScriptDriver,代码行数:19,代码来源:RunTests.java

示例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));
}
 
开发者ID:sumeetchhetri,项目名称:gatf,代码行数:17,代码来源:SeleniumTest.java

示例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));
}
 
开发者ID:sumeetchhetri,项目名称:gatf,代码行数:16,代码来源:SeleniumException.java

示例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;
}
 
开发者ID:cerberustesting,项目名称:cerberus-source,代码行数:16,代码来源:WebDriverService.java

示例5: clearlogs

import org.openqa.selenium.logging.Logs; //导入方法依赖的package包/类
public void clearlogs(String logType) {
    Logs logs = manage().logs();
    logs.get(logType);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:5,代码来源:JavaDriver.java


注:本文中的org.openqa.selenium.logging.Logs.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。