summaryrefslogtreecommitdiff
path: root/tests/test_tools/selenium/core/SeleniumLog.html
blob: dfa0080ad7fe258e90449472d9b534929c0ca84c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<html>

<head>
<title>Selenium Log Console</title>

</head>
<body id="logging-console">

<script language="JavaScript">

var logLevels = {
    debug: 0,
    info: 1,
    warn: 2,
    error: 3
};

var logLevelThreshold = null;

function getThresholdLevel() {
    var buttons = document.getElementById('logLevelChooser').level;
    for (var i = 0; i < buttons.length; i++) {
        if (buttons[i].checked) {
            return buttons[i].value;
        }
    }
}

function setThresholdLevel(logLevel) {
    logLevelThreshold = logLevel;
    var buttons = document.getElementById('logLevelChooser').level;
    for (var i = 0; i < buttons.length; i++) {
    	if (buttons[i].value==logLevel) {
            buttons[i].checked = true;
        }
        else {
            buttons[i].checked = false;
        }
    }
}

function append(message, logLevel) {
    if (logLevelThreshold==null) {
    	logLevelThreshold = getThresholdLevel();
    }
    if (logLevels[logLevel] < logLevels[logLevelThreshold]) {
        return;
    }
    var log = document.getElementById('log');
    var newEntry = document.createElement('li');
    newEntry.className = logLevel;
    newEntry.appendChild(document.createTextNode(message));
    log.appendChild(newEntry);
    if (newEntry.scrollIntoView) {
        newEntry.scrollIntoView();
    }
}

</script>

<div id="banner">
  <form id="logLevelChooser">
      <input id="level-error" type="radio" name="level" 
             value="error" /><label for="level-error">Error</label>
      <input id="level-warn" type="radio" name="level"
             value="warn" /><label for="level-warn">Warn</label>
      <input id="level-info" type="radio" name="level" checked="yes"
             value="info" /><label for="level-info">Info</label>
      <input id="level-debug" type="radio" name="level" 
             value="debug" /><label for="level-debug">Debug</label>
  </form>
  <h1>Selenium Log Console</h1>
</div>

<ul id="log"></ul>

</body>
</html>