top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is syntax of command used in Selenium?

+1 vote
314 views
What is syntax of command used in Selenium?
posted Sep 21, 2016 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Selenium commands are simple, they consist of the command and two parameters. For example:

verifyText //div//a[2] Login
The parameters are not always required; it depends on the command. In some cases both are required, in others one parameter is required, and in still others the command may take no parameters at all. Here are a couple more examples:

goBackAndWait
verifyTextPresent Welcome to My Home Page
type id=phone (555) 666-7066
type id=address1 ${myVariableAddress}
The command reference describes the parameter requirements for each command.

Parameters vary, however they are typically:

a locator for identifying a UI element within a page.
a text pattern for verifying or asserting expected page content
a text pattern or a selenium variable for entering text in an input field or for selecting an option from an option list.
Locators, text patterns, selenium variables, and the commands themselves are described in considerable detail in the section on Selenium Commands.

Selenium scripts that will be run from Selenium-IDE will be stored in an HTML text file format. This consists of an HTML table with three columns. The first column identifies the Selenium command, the second is a target, and the final column contains a value. The second and third columns may not require values depending on the chosen Selenium command, but they should be present. Each table row represents a new Selenium command. Here is an example of a test that opens a page, asserts the page title and then verifies some content on the page:

open/download/
assertTitleDownloads
verifyText//h2Downloads

Rendered as a table in a browser this would look like the following:

open /download/
assertTitle Downloads
verifyText //h2 Downloads
The Selenese HTML syntax can be used to write and run tests without requiring knowledge of a programming language. With a basic knowledge of selenese and Selenium-IDE you can quickly produce and run testcases.
for more information go to this link
http://www.seleniumhq.org/docs/02_selenium_ide.jsp

answer Oct 2, 2016 by Devendra Bohre
...