Selenese: Comandos para Selenium

Selenium: Comandos SeleneseComo continuación a nuestro artículo de introducción a Selenium, hoy os traemos un listado con los comandos que se pueden utilizar dentro de Selenium (Selenese), y que le dicen al motor de automatización de Selenium qué tareas debe realizar.

Hay 3 tipos de comandos:

  1. Acciones (Actions) : Modifican el estado de la aplicación, por ejemplo: pulsar un botón/ enlace.
  2. Accesos (Accessors): Comprueban el estado de la aplicacióin y almacenan el resultado en variables. Por ejemplo: “Store Title”—> Devuelve el título de la página actual.
  3. Afirmaciones (Assertions): Son como los anteriores pero estos comprueban el estado de la aplicación con lo que se esperaba. Por ejemplo: Comprobar que el título de una pagina es “Selenium: Comandos Selenese”.

Las afirmaciones se pueden clasificar en 3 tipos:

a) Assert: Cuando hay un fallo se aborta la prueba.

b) Verify: Cuando hay un fallo continua con la ejecución —>log.

c) Whait For: Espera a una condición.

A continuación os dejamos el listado completo de comandos:

Selenese Commands Descriptions
assignId(”Locator”,”String”) Temporarily sets the “id” attribute of the specified element
capture Screenshot (”File name”) Captures a PNG screenshot to thespecified file.
Check(”Locator”) Check a toggle-button(checkbox/radio)
click(”Locator”) Clicks on a link, button, checkboxor radio button.
clickAt(”Locator”,”Coordinate String”) Clicks on a link, button, checkboxor radio button.
close() Simulates the user clicking the”close” button in the title bar of a popup window or tab.
doubleClick(”Locator”) Double clicks on a link, button,checkbox or radio button.
doubleClickAt(”Locator”,”Coordinate String”) Double clicks on a link, button,checkbox or radio button.
getAlert() Retrieves the message of aJavaScript alert generated during the previous action, or fail if there were no alerts.
getAllButtons() Returns the IDs of all buttons onthe page.
getAllFields() Returns the IDs of all input fieldson the page.
getAllLinks() Returns the IDs of all links on the page.
getAllWindowIds() Returns the IDs of all windows that the browser knows about.
getAllWindowNames() Returns the names of all windows that the browser knows about.
getAllWindowTitles() Returns the titles of all windows that the browser knows about.
getAttribute(”Attribute Locator”) Gets the value of an element attribute.
getBodyText() Gets the entire text of the page.
getConfirmation() Retrieves the message of a JavaScript confirmation dialog generated during the previous action.
getCookie() Return all cookies of the current page under test.
getElementHeight(”Locator”) Retrieves the height of an element
getElementPositionLeft(”Locator”) Retrieves the horizontal position of an element
getElementPositionTop(”Locator”) Retrieves the vertical position of an element
getElementWidth(”Locator”) Retrieves the width of an element
getEval(”JS Expression”) Gets the result of evaluating the specified JavaScript snippet.
getLocation() Gets the absolute URL of the current page.
getMouseSpeed() Returns the number of pixels between “mousemove” events during dragAndDrop commands (default=10).
getPrompt() Retrieves the message of a JavaScript question prompt dialog generated during the previous action.
getSelectedId(”Select Locator”) Gets option element ID for selected option in the specified select element.
getSelectedIds(”Select Locator”) Gets all option element IDs for selected options in the specified select or multi-select element.
getSelectedIndex(”Select Locator”) Gets option index (option number, starting at 0) for selected option in the specified select element.
getSelectedIndexes(”Select Locator”) Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
getSelectedLable(”Select Locator”) Gets option label (visible text) for selected option in the specified select element.
getSelectedLables(”Select Locator”) Gets all option labels (visible text) for selected options in the specified select or multi-select element.
getSelectedValue(”Select Locator”) Gets option value (value attribute) for selected option in the specified select element.
getSelectedValues(”Select Locator”) Gets all option values (value attributes) for selected options in the specified select or multi-select element.
getSelectOptions(”Select Locator”) Gets all option labels in the specified select drop-down.
getSpeed() Get execution speed (i.e., get the millisecond length of the delay following each selenium operation).
getTable(”Table Cell Address”) Gets the text from a cell of a table.
getText(”Locator”) Gets the text of an element.
getTitle() Gets the title of the current page.
getValue(”Locator”) Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
get Whether This Frame MatchFrameExpression(”Current Frame”,”Target”) Determine whether current/locator identify the frame containing this running code
get Whether This Window MatchWindowExpression(”CurrentWindow”,”Target”) Determine whether currentWindow String plus target identify the window containing this running code.
goBack() Simulates the user clicking the “back” button on their browser.
highlight(”Locator”) Briefly changes the backgroundColor of the specified element yellow.
isAlertPresent() Has an alert occurred?
isChecked(”Locator”) Gets whether a toggle-button (checkbox/radio) is checked.
isConfirmationPresent() Has confirm() been called?
isEditable(”Locator”) Determines whether the specified input element is editable, ie hasn’t been disabled.
isElementPresent(”Locator”) Verifies that the specified element is somewhere on the page.
isPromptPresent() Has a prompt occurred?
isSomethingSelected(”Locator”) Determines whether some option in a drop-down menu is selected.
isTextPresent(”Pattern”) Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.
isVisible(”Locator”) Determines if the specified element is visible.
open(”URL”) Opens an URL in the test frame.
openWindow(”URL”,”WindowID”) Opens a popup window (if a window with that ID isn’t already open).
refresh() Simulates the user clicking the “Refresh” button on their browser.
removeAllSelections(”Locator”) Unselects all of the selected options in a multi-select element.
removeSelection(”Locator”,”Option Locator”) Remove a selection from the set of selected options in a multi-select element using an option locator.
select(”Select Locator”,”Option Locator”) Select an option from a drop-down using an option locator.
selectFrame(”Locator”) Selects a frame within the current window.
selectWindow(”WindowID”) Selects a popup window; once a popup window has been selected, all commands go to that window.
setSpeed(”Value”) Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation).
setTimeout(”Time”) Specifies the amount of time that Selenium will wait for actions to complete.
start() Launches the browser with a new Selenium session
stop() Ends the test session, killing the browser
submit(”Form Locator”) Submit the specified form.
type(”Locator”,”Value”) Sets the value of an input field, as though you typed it in.
unCheck(”Locator”) Uncheck a toggle-button (checkbox/radio)
waitForCondition(”JavaScript”,”Timeout”) Runs the specified JavaScript snippet repeatedly until it evaluates to “true”.
waitForFrameToLoad(”Frame Address”,”Timeout”) Waits for a new frame to load.
waitForPageToLoad(”Timeout”) Waits for a new page to load.
waitForPopUp(”WindowID”,”Timeout”) Waits for a popup window to appear and load up.
windowFocus() Gives focus to the currently selected window
windowMaximize() Resize currently selected window to take up the entire screen

Selenium: Comandos Selenese

Un comentario

Deja un comentario

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.