Selenium IDE


Selenium IDE typeKeys missing dot, period, or decimal 1

I discovered a bug in the Selenium IDE today where I needed to use the typeKeys command and the value included a period. The period would be stripped out for some reason. The solution is to break the command into two separate commands. First, use the “type” command and include the period or dot in the value (nick@gmail.). Then, create another command on the same input and use the “typeKeys” command to add the rest of the value (com).


Selenium IDE and TinyMCE 35

I created a test case for creating a support ticket.  Our support ticket interface has multiple tinymce editors present for the various ticket description and action update fields.  I had a difficult time find a solution that would make Selenium IDE type text into one of these tinymce editors, but I found one that worked using the dom.  Use command “type” and target should be “dom=document.getElementById(‘id_of_the_tinymce_frame’).contentDocument.body” and the value can be any text you want entered into the tinymce editor.

Note – if you copy and paste the dom code above, you may have to redo the single quotes around the id after you paste it somewhere else.  I did this and the character changed and threw me off for a bit.


Using variables with Selenium IDE 7

The “store” commands embedded into Selenium IDE are very useful when working with dynamic content.  “store” allows you to specify a variable and it’s value for use later on in your testing suite.  You can create a variable in one test case, then retrieve and use it in another.

I created a test case that creates a support ticket.  In all, I’ll need to create tests for creating the ticket, updating the ticket, and deleting the ticket.  All three can be upwards of 40-50 commands a piece once all the data verifications are included.  In order to keep test cases as small as possible, I’d store the new support ticket ID in a variable upon completion of the first test case that created the support ticket.

In this situation, the support ticket ID will be different every time, so “store”, which allows you to hardcode a variable value, will not work.  The command I used was “storeAttribute”, which allows you to locate an element, or it’s value, on a page using xPath and store it.  The target will use xpath “//input[@name=’newTicketId’]@value”, which selects the value of the input with name “newTicketId”.  The value will be your variable name, such as “newTicketId”.  To access this variable, references it like “${newTicketId}” in another command’s value.


Selenium IDE – How to follow links that open a new window 10

While building another test case, I ran into a situation that wasn’t working with the standard point and click navigation. Clicking on a dynamic link opened a new window where I needed to continue my test, but selenium didn’t follow the newly opened window. There are a few ways to do this, but what made this one difficult was that the link and new window was a dynamic url each time.
The fix was to store the link in a variable, then open the variable link with selenium using “open”. To store the variable I used “storeAttribute” and the target used xPath to grab the hyperlink’s href attribute from the url and save the variable as “ticketUrl” as in the image below: