Must know commands for Selenium IDE 47

Over the past couple weeks I’ve written 70 test cases with Selenium IDE.  Since completing the project, I’ve gone back to the first 20 or so and improved them with new commands that I learned and are more reliable in certain situations. In general, when working with elements on a page, the “target” should point to the ID of the element you’re working with and the value is many times optional.  In general, referencing the ID of an element instead of using xPath will save you work in the future when your page structure changes in the future.

Below are the commands I found most useful for testing our web application, which uses many forms and ajax.

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}.

Leave a comment

Your email address will not be published. Required fields are marked *

47 thoughts on “Must know commands for Selenium IDE

  • Praveen.Aithal.H

    I am searching for the command or some way, I can set value to the file uploading( input type = “file”). Tried typing value into the id of the “file_field_tag”. It is giving some security error!!!
    I need help

    Praveen Aithal H

  • Maria

    I am searching for the command or some way, that the pag that i’m testing wait xx time to check all the information. Can someone help me?

  • Ramachandran

    Can you please help me to use the command “verifyFocus” in selenium IDE ,

    Is it Possible to use this command in IDE,if yes can you help me to get user Extension for this command.


  • Nikhil

    I am looking for a command to check for redirections. Can you help.
    Help needed at the earliest.
    I am trying the command “assertLocation” but this doe not compare the absolute and relative URL’s

  • ALEX

    Hola estoy usando selenium ide y me ocurre que entre macro y macro necesito que espere un tiempo como un minuto o cosa asi pero no consigo encontrar el comando o la forma. automaticamente cuando ejecuto una lista de tareas programadas me las hace de corrido sin esperar entre tarea y tarea , haber si algien me hecha una mano por que no se me ocurre como hacerlo . tambien me gustaria saber como cambiar el tiempo de espera sin actividad que son 3000 ms lo he cambiado a 6000 pero se ha quedado en 3000 y no se cambia si la pagina tarda en cargar mas tiempo da error no puede continuar y se detiene y asi detiene todo el proceso. aqui os dejo estos dos problemillas que tengo haber si soys capaces de solucionarlo . un saludo .

  • ALEX

    Hello I am using selenium ide and it happens to me that between macro and macro need that it waits a time as a minute or sews this way but do not manage to find the command or the form. Automatic when I execute a list of programmed tasks it does them to me of traversed without waiting between task and task, credit if algien a hand for which it does not happen to me like to do it. Also me gustaria to be able change like the time of wait without activity that they are 3000 ms I it have changed to 6000 but it has remained in 3000 and does not change if the page is late in loading mas time gives mistake cannot continue and stops and this way it stops the whole process. Here I leave these two you problemillas that has to exist if soys capable of solving it. A greeting.

  • dipanjanc

    I am facing one serious problem in my project. I used to automate
    different login operation with selenium IDE.

    This project has a portal, which was automated (to check the LOG-IN
    operation) through selenium.

    Now some code base changed, and now the project flow has been

    Previously it only showing the Login page and then landed to Home

    But now, before Home page, there are 2 pop up generated.

    1) 1st pop up for JVNL file, on which “OK” and “Cancel” button is
    there, after clicking “OK”, I can proceed.
    2) After clicking “OK”, 2nd pop up will appear, which is Java Applet
    pop up, on which “Run” and “Cancel” button is there.
    After clicking “Run”, I can able to go to Home page.

    Even I have tried with many pop up based solutions, but could not
    reach to my ultimate goal.

    I need to modify the script for automation, means I need to make these
    2 pop up script in my file and update the script.

    so please get back to me if all of you have any suggestion.

    Thanks in advance.

    • nicholas

      you need to call javascript. not sure what yours is but here’s an example:

      Command Target

      runScript CKEDITOR.instances[‘description’].setData(‘testContent‘);

      ….. so Ckeditor in this case is the java applet, and the instance is set by the developer. Hope this helps, this is java script, may java applet is different.

      • nicholas

        and obviously you’d want to do something different than set the data… like push button or something. whatever’s in the code for the button. I’m sure the developer knows.

  • Tom

    The pause() doesn’t work for me at all (Se IDE 1.0.10, IceWeasel 3.5.16). Instead I use waitForCondition(). The condition I use is simply the boolean value true and the value is the length of time in milliseconds to pause.

  • Vinaykumar Patel

    “Run this command” (by pressing “x”) you can run one command.
    I want to run set of command in the same way. I got 100 commands in one test case and I want to run only 5 of them by pressing one key. I tried while but it ddn’t help much.

  • vikas

    While testing the web application How can we check the conditions like availability of of username & password ?
    e.g. Login on gmail.

    What commands we need to use to verfiy these condition in Selenium IDE ?

    Please reply.


    Vikas Patil.

  • saranya

    hi, this post was really useful. i want to chk whether 2 passwords are same. am using store value but its storing an empty string. am facing same problem for all fields whose input type=password. can anyone tell me how to capture password using selenium ide

    Thanks in advance.

  • venkat

    click/clickAndWait performs a click operation, and optionally waits for a new page to load.
    verifyTitle/assertTitle verifies an expected page title.
    verifyTextPresent verifies expected text is somewhere on the page.
    verifyElementPresent verifies an expected UI element, as defined by its HTML tag, is present on the page.
    verifyText verifies expected text and it’s corresponding HTML tag are present on the page.
    verifyTable verifies a table’s expected contents.
    waitForPageToLoad pauses execution until an expected new page loads. Called automatically when clickAndWait is used.
    waitForElementPresent pauses execution until an expected UI element, as defined by its HTML tag, is present on the page

  • vishal

    Hi ravi,
    You can either use pause command by setting time to wait for the link to be visible if you know how much time it will take.
    The other way which is best in this case is to use “waitforvisible” command

  • swetha

    Actually ,in my project it giving an error like command error particular id is not founding like that it is coming while testing using the debug

  • Nataraja

    when i am inserting data in a table , i have to select one foreign value from the drop down list , while recording selenium i am selecting the value and successfully saved in database, but when i play selenium
    the value not taken to text field , i given command as “select” but still not working ,
    plz answer