Selenese – Selenium Commands: Actions, Asserts, Accessors
What is Selenese?
Selenese is the command language used by Selenium IDE, made up of commands that fall into three categories.
Actions
Perform operations on the browser or elements — like click, type, or open — and generally cause some change of state.
Assertions
Verify that the application is in the expected state, e.g. assertTitle or assertText, causing the test to fail immediately if the condition doesn't hold.
Accessors
Read and store a value from the page (like storeTitle) for later use in the test, without asserting anything directly.
How a Selenese Command Is Structured
Every step in Selenium IDE is a row with up to three parts: the command, a target and a value. The target usually identifies an element using a locator such as id=email, css=button.submit or xpath=//a[text()='Login']. The value holds input text or a variable name.
Worked example: a login test in Selenium IDE
| Command | Target | Value |
|---|---|---|
| open | /login | |
| type | id=email | tester@example.com |
| type | id=password | Secret123 |
| click | css=button[type='submit'] | |
| waitForElementVisible | css=.welcome | 5000 |
| assertText | css=.welcome | Welcome back |
| storeTitle | pageTitle | |
| echo | ${pageTitle} |
Reading it top to bottom: the first four rows are actions that change the page, the wait command gives the page time to load, the assertion checks the result, and the store command saves the page title into a variable that later steps read as ${pageTitle}.
Assert vs Verify: Choosing the Right Check
Selenium IDE offers two families of checks. They test the same thing but react differently to failure:
- assert commands (for example
assertText,assertElementPresent) stop the test immediately if the check fails. Use them when later steps make no sense without this condition, such as confirming the login worked. - verify commands (for example
verifyText,verifyTitle) record the failure but let the test continue. Use them when you want to collect several independent checks on one page, such as labels on a form.
Many commands also come in a "not" form, such as assertNotText, to confirm something is absent.
From Selenese to WebDriver Code
Selenium IDE can export recorded tests to code for languages such as Java, Python and C#. The same login check in Java WebDriver looks roughly like this:
driver.get(baseUrl + "/login");
driver.findElement(By.id("email")).sendKeys("tester@example.com");
driver.findElement(By.id("password")).sendKeys("Secret123");
driver.findElement(By.cssSelector("button[type='submit']")).click();
WebElement welcome = new WebDriverWait(driver, Duration.ofSeconds(5))
.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".welcome")));
assertEquals("Welcome back", welcome.getText());
Record-and-playback is great for quick checks and for learning locators. For large suites, teams usually move to WebDriver code so they can add page objects, data-driven tests and proper reporting.
Common Selenese Mistakes
- Using pauses instead of waits. A fixed
pauseslows every run and still fails on a slow day. PreferwaitFor...commands. - Fragile recorded locators. Recorded XPath often depends on page layout. Edit it to use a stable id or data attribute.
- No assertions. A test that only clicks around proves very little; add checks after each important action.
- Hard-coded test data in every row instead of storing it once in a variable.
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.