0

I have some Selenium tests I've been building with the Firefox IDE plugin. This is the first I've attempted tests like this, the client asked for it, as I'm refactoring some code and they want to be certain things still work.

I have an element that resizes via a script, and I need to test its height. My Selenium source currently looks something like:

<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>/landing-page</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=a.facebook.</td>
    <td></td>
</tr>
</tbody></table>

I need to test that an element is greater than a certain height. How do I write that in after clicking on the .facebook link?

1 Answer 1

1

There is not a vanilla way of doing such a thing. You'd have to create your own javascript plugin to put into the IDE. Learn how to structure a javascript plugin for the IDE, then you can put something like this into it (mind you this is pseudo-code):

function validateHeight(HTMLElement element, int height) {
  return assertTrue(element.height == height);
}
4
  • Sound like the right path, do you have any preferred resources on this for someone who's never really worked with test before?
    – Randy Hall
    Mar 13, 2014 at 19:48
  • As an avid user of Selenium WebDriver, not so much RC or IDE, i do have one recommendation... Ditch IDE. if you are intending for this selenium project to be worth something in the long run, then i recommend using a solution like the getting started with selenium project (which is Java). Either way, migrate to Selenium WebDriver. If you are intending to keep with the IDE, then i think adam.goucher.ca/?p=1348 should help
    – ddavison
    Mar 13, 2014 at 19:52
  • I could go either way on the IDE vs WebDriver, I'll give WebDriver a look thanks!
    – Randy Hall
    Mar 13, 2014 at 19:56
  • 1
    well, there are clear cut definitions on what you want. take a look at this picture, you can see that they both have their different uses.
    – ddavison
    Mar 13, 2014 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.