-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
stale.html
62 lines (59 loc) · 2.15 KB
/
stale.html
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
<!DOCTYPE html>
<html>
<head>
<title>Webdriverio Testpage for StaleElementRetry test</title>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
<h1>Webdriverio Testpage</h1>
</header>
<section class="page">
<div style="background:silver;">
<h2>staleElementTests</h2>
<h3>Test 1</h3>
<ul class="staleElementContainer1"></ul>
<h3>Test 2</h3>
<ul class="staleElementContainer2"></ul>
</div>
<script>
function addRow(container, count) {
var newRow = document.createElement('li');
newRow.classList.add('stale-element-container-row');
newRow.classList.add('stale-element-container-row-' + count);
newRow.innerHTML = count;
container.appendChild(newRow);
return newRow;
}
function removeRow(row) {
if (row) row.parentNode.removeChild(row);
}
function staleElementTest1() {
var container = document.querySelector('.staleElementContainer1');
var count = 0;
var lastRow;
function loop() {
count++;
removeRow(lastRow);
lastRow = addRow(container, count);
}
setInterval(loop, 200);
}
function staleElementTest2() {
var container = document.querySelector('.staleElementContainer2');
var timeout = 200;
for (var i = 1; i <= 40; i++) {
timeout += 311;
var row = addRow(container, i);
setTimeout(removeRow.bind(null, row), timeout);
}
}
staleElementTest1();
staleElementTest2();
</script>
</section>
</body>
</html>