---
Help: Ensure we wait for elements to appear
---
This test ensures we can wait for elements explicitly (which means test will stop on timeout), but also implicitly (which will cause exception).


!define HTML1 { {{{
<html>
<title>Start Page Title</title>
<body>
<input name="remove" type="button" value="Remove">
<label>Add button<input name="add" type="button" value="Add"></label>
<a id="link" href="#">My link</a>
<b>My first mixed content string<br/>My second mixed content string</b>
</body>
</html>}}} }

!define HTML2 { {{{
<html>
<title>Start Page Title</title>
<body>
<input name="remove" type="button" value="Remove">
<label>Add button<input name="add" type="button" value="Add"></label>
<label id="addL" for="inp2">Add 2 button</label><input id="inp2" value="Toevoegen">
<a id="link" href="#">My link</a>
<script type="text/javascript">
    window.onload = function() {
		setTimeout(function() { document.title = "Changed Page Title"; }, 500);
		setTimeout(function() { document.getElementById("link").innerHTML = "Hallo link\n"; }, 1500);
		setTimeout(function() { document.getElementsByName("add")[0].setAttribute("value", "Add more"); }, 2000);
		setTimeout(function() { document.getElementById("addL").innerHTML = "Button to add more"; }, 2500);
		setTimeout(function() { document.getElementsByName("remove")[0].setAttribute("value", "Remove more"); }, 2500);
    }
</script>
</body>
</html>}}} }

|script      |mock xml server setup|
|add response|${HTML1}             |
|add response|${HTML2}             |
|$url=       |get mock server url  |

|script                          |browser test                                                   |
|open                            |$url                                                           |
|check                           |page title                      |Start Page Title              |
|check                           |value of                        |Add button        |Add        |
|ensure                          |click if available              |My link                       |
|seconds before timeout          |1                                                              |
|check                           |seconds before timeout          |1                             |
|check                           |seconds before page load timeout|1                             |
|wait for visible                |My first mixed content string                                  |
|wait for visible                |My second mixed content string                                 |
|seconds before page load timeout|4                                                              |
|check                           |seconds before timeout          |1                             |
|check                           |seconds before page load timeout|4                             |
|refresh                                                                                         |
|wait for page                   |Changed Page Title                                             |
|click                           |Hallo link                                                     |
|click                           |Add more                                                       |
|check                           |value of                        |Button to add more|Toevoegen  |
|note                            |non-existing item's value is null                              |
|check                           |value of                        |delete            |null       |
|note                            |text may be value or actual text, and will be trimmed          |
|wait for tag                    |a                               |with text         |Hallo link |
|wait for tag                    |input                           |with text         |Remove more|
|wait for visible                |Add button                                                     |
|reject                          |click if available              |My link                       |

|script|mock xml server setup|
|stop                        |
