CS/IT Tutorials Collections

Top 46 Basic Selenium IDE Commands You Should Know Well

Pinterest LinkedIn Tumblr

The set of selenium IDE commands that runs your test is called selenese and the sequence of commands is called test scripts. We have already introduced some of the basic selenium commands and the common types of selenium commands in the previous articles. In this post, we are writing in detail about the common Selenium IDE commands included under actions, accessors, and assertions.

Read Also: What is Selenium Tool Suite & How to Choose the Right Tool

Selenium IDE Commands Under Actions

These are the commands that manipulate the state of the applications.  Following are the selenium IDE commands that fall under Actions.

  1. Open – Opens the URL and waits for the page to load before proceeding. It accepts both the relative and absolute URLs.
  2. Click – Clicks on the target element such as links, buttons, checkboxes, and radio buttons.
  3. Click at – Clicks on target elements such as links, buttons, checkboxes, or radio buttons. The coordinates are relative to the target element where 0,0 is the top left corner of the element.
  4. Double click – Double clicks on the target element such as links, buttons, checkboxes, and radio buttons.
  5. Double click at – It double clicks on target elements such as links, buttons, checkboxes, or radio buttons. The coordinates are relative to the target element where 0,0 is the top left corner of the element.
  6. Type – It sets the value of an input field, as though you typed it in. You can also use this command to set the value of combo boxes, checkboxes, etc.
  7. Select – This command will select an element from a drop-down menu using an option locator. Option locators provide different ways of specifying a select element such as label=, value=, id=, and index=.
  8. Select frame – It selects a frame within the current window. You may invoke this command multiple times to select a nested frame. In order to select the parent frame, you should use “relative=parent” as a locator.
  9. Select window – This command will select a popup window using a window locator. Once a popup window has been selected, all commands will go to that window.
  10. Add selection – Add a selection to the set of options in a multi-select element.
  11. Remove selection – It will remove a selection from the set of selected options in a multi-select element using an option locator.

Read Also: How To Start Test Automation With Selenium IDE

Selenium IDE Commands Under Accessors

Here are the commands that examine the state of the application and stores that result in a variable. Following are the selenium IDE commands that fall under accessors.

  1. Store – It saves a target string as a variable for reuse purposes. You can enter the variable name on the target field and the value of the variable on the value field.
  2. Store attribute – This command will get the value of an element attribute. You will require to use the attribute locator and variable name to use the store attribute. Where the attribute locator is an element locator followed by an @ sign and then the name of the attribute. So, you can use the variable name either to store an expression result or reference for a check.
  3. Store text – It gets the text of an element and stores it for later use. So, you can use this command for any element containing text. The element locator should be specified on the target field and the variable to store element text in the value field.
  4. Store value – This command will get the value of an element and stores it for reuse purpose. It will work for any input type elements. You should use the element locator on the target field and the variable name on the value field.
  5. Store title – It will get the title of the current page and store it on the variable provided.
  6. Store XPath count – It gets the number of nodes that match the specified XPath, eg. “//h2” would give the number of h2 tags.

Read Also: How to Write Test Cases Manually in Selenium IDE

Selenium IDE Commands Under Assertions

Assertions will verify the state of the application and confirm whether the elements or their properties are found as expected. There will be three types of selenium IDE commands assert, verify and wait for fall under assertions.

Verify Commands Under Assertions

These are the commands that verify the commands under assertions.  Following are the selenium IDE commands that fall under Assertions.

  1. Verify – It is a soft assert that a variable is an expected value where the variable’s value will convert to a string for comparison. So, it requires providing the variable name and expected value.
  2. Verify checked – You can use this command to verify whether the toggle buttons such as checkbox and radio buttons checked or not.  You have to specify an element locator on the target field.
  3. Verify not checked – You can use this command to verify whether the toggle buttons such as checkbox and radio buttons checked or not.
  4. Verify editable – You can use this command to verify whether the specified input element is editable and not disabled. You have to provide an element locator to verify the element is editable.
  5. Verify not editable – You can use this command to verify whether the specified input element is not editable and disabled.
  6. Verify element present – It will verify whether the specified element is somewhere on the page. You have to provide an element locator to verify the element present.
  7. Verify element not present – It will verify whether the specified element is not somewhere on the page.
  8. Verify selected value – It will verify whether the expected element has been chosen in a select menu by its option attribute. You should specify an element locator identifying a drop-down menu.
  9. Verify text – It will verify whether the text of an element is present. Here you should provide an element locator and the text to verify.
  10. Verify title – It will verify whether the title of the current page contains the provided text.
  11. Verify value – It will verify the value of an input field. You should specify the locator and text for comparing with a value of the input field.

Assert Commands Under Assertions

These are the commands that verify the commands under assertions.  Following are the selenium IDE commands that fall under Assertions.

  1. Assert – This command will check that a variable is an expected value.  It will convert the variable value to a string for comparison.
  2. Assert alert – It will check whether an alert will render with the provided text.
  3. Assert checked – You can use this command to check whether the target element is checked. You have to specify an element locator on the target field.
  4. Assert confirmation – It will confirm whether confirmation has been rendered.
  5. Assert editable – This command will confirm whether the target element is editable. You have to specify an element locator on the target field.
  6. Assert element present – It will confirm whether the target element is present somewhere on the page.
  7. Assert selected value – This command will confirm the value attribute of the selected option in a drop-down element containing the provided value. It will require providing an element locator identifying a drop-down menu and an exact string to match.
  8. Assert prompt – It will confirm that a JavaScript prompt has been rendered.
  9. Assert selected label – This command will confirm the label of the selected option in a drop-down element containing the provided value. It will require providing an element locator identifying a drop-down menu and an exact string to match.
  10. Assert text – It will confirm the text of an element contains the provided value. It will require providing an element locator and an exact text string to match.
  11. Assert title – It will confirm the title of the current page contains the provided text.
  12. Assert value – It will confirm the value of an input field. While using this command for checkbox/radio elements, the value will be “on” or “off” depending on whether the element is checked or not.

WaitFor Commands Under Assertions

  1. Wait for an element editable – It waits for an element to be editable after loading the webpage. You have to specify an element locator and the amount of time to wait in milliseconds.
  2. Wait for an element not editable – It waits for an element not to be editable after loading the webpage. You have to specify an element locator and the amount of time to wait in milliseconds.
  3. Wait for element present – It waits for a target element to be present on the page. You have to specify an element locator and the amount of time to wait in milliseconds.
  4. Wait for an element not present – It waits for a target element not to be present on the page. You have to specify an element locator and the amount of time to wait in milliseconds.
  5. Wait for an element visible – It waits for a target element to be visible on the page. You have to specify an element locator and the amount of time to wait in milliseconds.
  6. Wait for an element not visible – It waits for a target element not to be visible on the page. You have to specify an element locator and the amount of time to wait in milliseconds.

Read Next: Ways of Locating Elements Using Selenium IDE Commands

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.