forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamicallyModifiedPage.html
42 lines (36 loc) · 1.08 KB
/
dynamicallyModifiedPage.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
<?xml version="1.0">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Delayed remove of an element</title>
<script type="text/javascript">
var parentNode;
var elementId;
function timedRemove()
{
var t = setTimeout('removeElement()', 500);
t = setTimeout('insertElement()', 2000);
}
function removeElement()
{
var element = document.getElementById('element-to-remove');
elementId = element.id;
parentNode = element.parentNode;
parentNode.removeChild(element);
}
function insertElement()
{
var newElement = document.createElement('p');
newElement.setAttribute('id', elementId);
newElement.innerHTML = 'new element';
parentNode.appendChild(newElement);
}
</script>
</head>
<body>
<form>
<input id="buttonDelete" type="button" value="element will be removed in half a second"
onclick="timedRemove()"/>
</form>
<p id="element-to-remove">element</p>
</body>
</html>