Skip to content

SeleniumCommonStepdefs

Antoine Neveux edited this page Feb 5, 2015 · 1 revision

#Selenium Common Stepdefs

Version 1.0, written by mechikhi, generated by Docukes on Thu Feb 05 18:39:14 CET 2015

##Description

This class aims at containing all the common operations you may use in thetests scenarios. Things like dealing with the configuration, or manipulatingexternal tools, etc.

##Stepdefs

###navigate To Path

Syntax: Given: "^navigate to path \"([^\"]*)\"$"

Documentation:

Allows to navigate to a specified path

###refresh Page

Syntax: Given: "^refresh the page$"

Documentation:

Allows to refresh the current page

###move And Click On An Element

Syntax: Given: "^move to and click element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Moves the cursor on an element identified by any selector and clicks onit

###select An Element

Syntax: Given: "^select element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" by text \"([^\"]*)\"$"

Documentation:

Selects a particular text from an element identified by any selector

###select An Element By Value

Syntax: Given: "^select element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" by value \"([^\"]*)\"$"

Documentation:

Selects a particular value from an element identified by any selector

###click On An Element

Syntax: Given: "^click element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Clicks on an element identified by any selector

###submit An Element

Syntax: Given: "^submit element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Submits an element identified by any selector

###add Text To An Element

Syntax: Given: "^send a text \"([^\"]*)\" to element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Sends a text to an element identified by any selector

###add Text To An Alert And Accept

Syntax: Given: "^send a text \"([^\"]*)\" to alert and accept$"

Documentation:

Sends a text to an alert and accepts it

###check Presence Of An Element

Syntax: Then: "^the element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" should be present$"

Documentation:

Checks if an element identified by any selector is present on the page

###check Absence Of An Element

Syntax: Then: "^the element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" should not be present$"

Documentation:

Checks if an element identified by any selector is not present on thepage

###check If An Element Contains

Syntax: Then: "^the element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" should contain \"([^\"]*)\"$"

Documentation:

Checks if an element identified by any selector contains some value

###check The Notification Message

Syntax: Then: "^the notification message should be \"([^\"]*)\"$"

Documentation:

Checks if the notification message is as expected

###wait Until Loading The Attribute Of An Element

Syntax: When: "^wait until loading the attribute \"([^\"]*)\" of element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Allows to wait till the atribute of a particular element has been loaded

###check If The Attribute Of An Element Contains

Syntax: Then: "^the attribute \"([^\"]*)\" of element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" should contain \"([^\"]*)\"$"

Documentation:

Checks if a specified attribute of an element identified by any selectorcontains a particular value

###save The Attribute Of An Element

Syntax: Then: "^save with \"([^\"]*)\" key the attribute \"([^\"]*)\" of element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Allows to store in the execution context the attribute of an elementidentified by any selector using a particular key

###check If The Page Source Contains

Syntax: Then: "^the text of the page source should contain \"([^\"]*)\"$"

Documentation:

Allows to check if the page source code contains a particular text

###accept An Alert

Syntax: Then: "^accept the alert$"

Documentation:

Accepts the alert

###move To An Element

Syntax: When: "^move to element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Moves to an element identified by any selector

###wait For An Element To Contain

Syntax: When: "^wait (\\d+) seconds for element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" contains \"([^\"]*)\"$"

Documentation:

ALlows to wait for a certain amount of time for an element to to containa particular value

###wait For Some Seconds

Syntax: When: "^wait for (\\d+) seconds$"

Documentation:

Waits for a certain time

###wait Until An Element Contains

Syntax: When: "^wait until element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" contains \"([^\"]*)\"$"

Documentation:

Waits untill a particular element, identified by any selector, contains aparticular value

###wait Until An Element Is Present

Syntax: When: "^wait until element having (id|name|class|css|link|tag|xpath) \"([^\"]*)\" is present$"

Documentation:

Waits untill a particular element is present

###switch To A Frame

Syntax: Given: "^switch to frame having (id|name|class|css|link|tag|xpath) \"([^\"]*)\"$"

Documentation:

Switches to a frame identified by any selector

###switch To Previous Window

Syntax: Given: "^switch to previous window$"

Documentation:

Switches to the previous window

###switch To Main Content In Page

Syntax: Given: "^switch to main content in page$"

Documentation:

Switches to the main content in the page

###switch To New Window

Syntax: Given: "^switch to new window$"

Documentation:

Switches to a new window

###close The Browser

Syntax: Given: "^close the browser$"

Documentation:

Closes the browser

Clone this wiki locally