UNPKG

@christian-bromann/webdriverio

Version:

A nodejs bindings implementation for selenium 2.0/webdriver

63 lines (59 loc) 2.2 kB
<!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>