Ensuring a divs content has changed over time in Selenium

Posted by Stewart Robinson on Stack Overflow See other posts from Stack Overflow or by Stewart Robinson
Published on 2010-06-03T09:20:50Z Indexed on 2010/06/03 9:24 UTC
Read the original article Hit count: 265

Filed under:

I have a div that contains a slideshow. ( http://film.robinhoodtax.org/issues/education )

I am using Selenium to test it. So far I have been using the HTML/Selenium script below to validate that the slideshow is actually working. But my assertEval is failing.

How can I correctly detect the slideshow and make sure it is moving?.

You can see I've approached this by storing the HTML and waiting then trying again but it isn't working.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>/issues/education</td>
    <td></td>
</tr>
<tr>
    <td>waitForPageToLoad</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>assertElementPresent</td>
    <td>css=div[id='views-nivo-slider-ImagesGallery-block_1']</td>
    <td></td>
</tr>
<tr>
    <td>storeHtmlSource</td>
    <td>css=div[id='views-nivo-slider-ImagesGallery-block_1']</td>
    <td>first</td>
</tr>
<tr>
    <td>pause</td>
    <td>3000</td>
    <td></td>
</tr>
<tr>
    <td>storeHtmlSource</td>
    <td>css=div[id='views-nivo-slider-ImagesGallery-block_1']</td>
    <td>second</td>
</tr>
<tr>
    <td>assertEval</td>
    <td>${first} == ${second}</td>
    <td>second</td>
</tr>

</tbody></table>
</body>
</html>

© Stack Overflow or respective owner

Related posts about selenium