</>

Technology

Selenium

Difficulty

Beginner

Interview Question

What is Selenese?

Answer

What is Selenese?

Selenese is the command/scripting language used to write test scripts in Selenium IDE. It is a set of commands that the IDE understands and uses to interact with the browser.

Categories of Selenese commands:

1. Actions — Interact with the page:

  • open — Open a URL
  • click — Click on an element
  • type — Enter text into a field
  • select — Select from a dropdown
  • submit — Submit a form
  • pause — Pause execution

2. Accessors — Read values from the page:

  • getText — Get element''s text
  • getValue — Get input field value
  • getTitle — Get page title
  • getLocation — Get current URL

3. Assertions — Verify expected values:

  • assertText — Assert element text matches
  • assertTitle — Assert page title
  • assertElementPresent — Assert element exists
  • verifyText — Verify (soft check — continues on failure)

Example Selenese test (Selenium IDE format):

CODE
Command         | Target                  | Value
----------------|-------------------------|------------------
open            | https://example.com     |
type            | id=username             | admin
type            | id=password             | password123
click           | id=loginBtn             |
assertTitle     |                         | Dashboard
assertText      | id=welcomeMsg           | Welcome, admin!

Assert vs Verify in Selenese:

  • assert commands — Stop test on failure
  • verify commands — Log failure but continue test

Selenese to Java translation:

CODE
Selenese: click | id=loginBtn
Java: driver.findElement(By.id("loginBtn")).click();

Selenese: type | name=username | admin
Java: driver.findElement(By.name("username")).sendKeys("admin");

Selenese: assertTitle | Dashboard
Java: Assert.assertEquals(driver.getTitle(), "Dashboard");

Key point: Selenese is the language used to write test scripts in Selenium IDE — it''s a domain-specific set of commands specific to the Selenium IDE environment.

Follow AutomateQA

Related Topics