Selenium IDE

UPDATE 20120101

 

IDE for loops etc is god aweful.

So now off to learn Java & WebDriver...

 


UPDATE 20121207

So after 3.5 years I am about to try Selenium IDE again.

I see buzz words like data driven and that is my goal (I'm not sure if i will load my data via the data driven plugin but i expect I will just load it as JSON via user extensions option)

 I really like the idea of UI-Elements so spent quite some time mapping a couple of pages.

Using Selenium 1.09 FF8

Major issue no 1:

With UI-Elements, xPathCount won't work, a hardcoded identical XPath works fine, but a Ui-Eleent map locator just doesn't  (the same issue as this poster: http://seleniumforum.forumotion.net/t1056-stored-variable-as-an-argument-of-uimap)

In user-extensions.js:

map.addElement('common_page', {name: 'test', description: 'test', locator: "//*"});

Result:

  • [info] Executing: |storeXpathCount | ui=common_page::test() | count |
  • [error] Invalid xpath [2]: ui=common_page::test()

IDE tab UI-Element correctly shows:

common_page::test
common page elements
test

current specifier maps to locator:
    //*

 

 

 




In 2009:

Installed

  • Selenium IDE      June 30, 2009      1.0.2
  • Firebug 1.4.5
  • Firefinder for Firebug

 


 XPATH: http://xpathvisualizer.codeplex.com/

 


Quirks/usfukl:

http://www.jroller.com/selenium/

http://agiletesting.blogspot.com/2006/03/ajax-testing-with-selenium-using_21.html

 


Test manager:

testopia

bromine - seems active

The Universal Test Framework - looks like renamed to HRMES

Selenium Test Manager - looks inactive

 


 

HTML Suite & case examples:

http://pculture.org/devblogs/mirotesting/guide-testing-with-selenium/

 


 

Screen shot capture:

        selenium.captureScreenshot("/tmp/" + this.getClass().getName() + "."
+ testMethodName + ".png");

 


 

echo - I always echo out some text that will help me identify the current test case.  When you’re looking through the logs after running your whole suite of tests, the logs all run together with no break.  You can’t tell which test case had an error unless you echo something like —————- my test case name ————

open - tells the browser to open a specific page.  This is useful if you don’t want the test to navigate to a page and instead just want it to go straight there.  This can be a relative path so you can use it on both a testing and live environment.

Type and TypeKeys - type will place text in an input.  Typekeys will actually mimic entering one key at a time so any onkeyup() functionality you might have going on will work.  We have autocomplete search boxes that required TypeKeys.

verifyTextPresent - Verifies that text appears on the page.  It can be dynamic text that was loaded with ajax.  If it’s on the page in the active window at the time this command is called, it’ll find it.

verifyValue - Verifies the value of an input field.  Provide the id of the input as the target and the value is the text you’re expecting.

click - tell the test to click something on the page.  The target can be referenced with the element ID or xPath as with the other commands.

clickAndWait - Useful for form submissions.  Many times when you’re in record mode and click a submit button, selenium will only record a “click” command.  This will break your test commands following the form submission where you verify the presence of a success message or form values because the next page hasn’t loaded yet.  The “wait” portion will wait to continue the testing when the next page has fully loaded.

select - select an option in a select box by providing the id of the select box and the option value.

pause - Tell the test to pause for a while.  Enter a target of 3000 for 3 seconds.  I started using this command frequently at first, especially when testing ajax.  However, as I went on I found better alternatives since a TCP/IP connection isn’t always reliable and doesn’t get returned on time, every time.

waitForVisible - This command tells the test to wait until an element, often returned by ajax, is visible before continuing.

storeAttribute - Selenium IDE can store variables and allows you to reference them in the same test case or another test case.  The target of this command should point to the text or value to store.  You’ll most likely use xPath for this one.  This example will reference the value of an input field named newTicketId //input[@name='newTicketId']@value .  The value of the storeAttribute command will be the variable name to save it as.  Reference the variable in another command with prototype syntax like ${variableName}.

 


 

Formulas:

<tr>
    <td>storeEval</td>
    <td>javascript{storedVars['CurrentBriefcase'] + 1}</td>
    <td>CurrentBriefcase</td>
</tr>

is identical to:

<tr>
    <td>storeEval</td>
    <td>${CurrentBriefcase} + 1</td>
    <td>CurrentBriefcase</td>
</tr>