Keyword
Library for Senuji Version 003.004
Senuji Basic Keyword Syntax: Keyword[Space]"Value"[Space]"Object"
Keyword
|
Introduction
|
Syntax
|
Example
|
AlertAccept
|
AlertAccept is used to accept alert.
AlertAccept can accept one alert at a time.
|
AlertAccept
|
AlertAccept
|
AlertDismiss
|
AlertDismiss is used to dismiss an alert. AlertDismiss can dismiss
one alert at a time.
|
AlertDismiss
|
AlertDismiss
|
AlertGetText
|
AlertGetText is used to read text from an alert and validate it with
expected result. AlertGetText can work with one alert at a time.
|
AlertGetText[Space]"Expected Result"
|
AlertGetText "Test Alert"
|
BrowserPosition
|
BrowserPosition used Position the Location of Running Browser.
You can use value text box to
key in x and y by separating them using coma
|
BrowserPosition[Space]"x coordinates,y coordinates"
|
BrowserPosition "100,100"
|
CaptureScreen
|
CaptureScreen is used to take screen shots while text execution.
Screen shots will be saved in
your ..\Default\ScreenShots folder.
Screen shot file name is a
combination of the date and time.
|
CaptureScreen
|
CaptureScreen
|
ClearTextBoxValue
|
ClearTextBoxValue is used to clear a textbox or text aria in a web
page.
ClearTextBoxValue can clear one object at a time.
ClearTextBoxValue requires the
target object or the locator to identify the test box and type of the locator
you use.
You can use select locator dropdown to select corresponding locator
type.
|
ClearTextBoxValue [Space]<”null”>[Space]"<Locator
Type><:><Object>"
|
ClearTextBoxValue "null"
"Xpath://*[@id='lst-ib']"
|
Click
|
Click is used to click an object in a web page.
Click can click one object at
a time.
Click requires the target
object or the locator to identify the object and type of the locator you
used.
You can use select locator
dropdown to select corresponding locator type.
|
Click [Space]"null"[Space]"<Locator
Type><:><Object>"
|
Click "null" "Xpath://*[@id='lst-ib']"
|
CloseBrowser
|
CloseBrowser is used to close the active browser.
|
CloseBrowser
|
CloseBrowser
|
DataInput
|
Introduction:
DataInput is used to read data from csv file and input to a textbox
or text aria in a web page.
DataInput can input values for
one object at a time.
DataInput requires the target
object or the locator to identify the test box and type of the locator you
use.
You can use select locator
dropdown to select corresponding locator type.
|
DataInput [Space]<"Data Field Sequence ID">
[Space]"<Locator Type><:><Object>"
|
DataInput "1" "Xpath://*[@id='lst-ib']"
|
DeselectAll
|
DeselectAll is used to de select items form list box or from combo
box
DeselectAll can work with one
list at a time.
|
DeselectAll[Space]"null"[Space]"Object"
|
DeselectAll "null" "Xpath://*[@id='lst-ib']"
|
DisplayCurrentUrl
|
DisplayCurrentUrl is used to log current URL on the browser
DisplayCurrentUrl can log one
URL at a time.
|
DisplayCurrentUrl
|
DisplayCurrentUrl
|
DisplayPageTitle
|
DisplayPageTitle is used to log current page title
DisplayPageTitle can log one
title at a time.
|
DisplayPageTitle
|
DisplayPageTitle
|
EndLoop
|
EndLoop is used mark end of the Loop
|
EndLoop
|
EndLoop
|
EnterText
|
EnterText is used to input a static keyboard input to a textbox or
text aria in a web page.
EnterText can input values
for one object at a time.
EnterText requires the target object or the locator to identify the
test box and type of the locator you use.
You can use select locator
dropdown to select corresponding locator type.
|
EnterText [Space]<"input value">
[Space]"<Locator Type><:><Object>"
|
EnterText "I like Senuji" "Xpath://*[@id='lst-ib']"
|
InputNumberVariableToTextbox
|
InputNumberVariableToTextbox is used to move number variable value to
text box
InputNumberVariableToTextbox
can work with one test box at a time.
You must define the variable using VariableNumber keyword and number
varible should read the value from the object using StoreNumberToVariable
keyword.
Length of the variable is not
limited but you cant have spaces in-between.
|
InputNumberVariableToTextbox[Space]"$Varible_Name"[Space]"Object
or Locator"
|
InputNumberVariableToTextbox "$PageID"
"Xpath://*[@id='lst-ib']"
Open
"http://stackoverflow.com/questions/5766318/converting-double-to-string"
VariableNumber "$ABC=0"
StoreNumberToVariable "$ABC"
"Xpath:.//*[@id='answer-9963574']/table/tbody/tr[1]/td[1]/div/span[1]"
InputStringVariableToTextbox "$ABC"
"Xpath:.//*[@id='fsr']/a[1]"
|
InputStringVariableToTextbox
|
InputStringVariableToTextbox is used to move string variable value to
text box
InputStringVariableToTextbox
can work with one test box at a time.
You must define the variable using VariableString keyword and String
varible should read the value
from the object using
StoreStringToVariable keyword.
Length of the variable is not
limited but you cant have spaces in-between.
|
InputStringVariableToTextbox[Space]"$Varible_Name"[Space]"Object
or Locator"
|
InputStringVariableToTextbox "$PageTitle"
"Xpath://*[@id='lst-ib']"
Open "https://www.google.lk/"
VariableSring "$ABC="
StoreStringToVariable "$ABC" "ID:_eEe"
InputStringVariableToTextbox "$ABC"
"ID:.//*[@id='lst-ib']"
|
LogMessageToConsole
|
LogMessageToConsole is used to log a message during test run in
Senuji Console
LogMessageToConsole can display one message at a time.
|
LogMessageToConsole [Space]<"Message">
|
LogMessageToConsole "Test Execution Started"
|
Loop
|
Loop is used to scan a ";" delimited csv file witch can use
to hold data as input to a test.
Loop will iterate all the
statements until it find EndLoop.
You can use any amount of loops with in the script but loop with a
loop is not possible.
CSV file has to be placed inside ..\Default\Data folder
|
Loop[Space]"csv File Name"
|
Loop "Test.cvs"
Sample Data table
"Gayan Perera";"20"
"Nirosan Bandara";"22"
"Erandika umal hungampola";"30"
|
MaximizeBrowser
|
MaximizeBrowseris used Maximize Running Browser
|
MaximizeBrowser
|
MaximizeBrowser
|
MoveSlider
|
MoveSlider is used to move or change value of a Slider object
MoveSlider can be used on one
Slider at a time.
MoveSlider requires the target object or the locator to identify the
Slider and type of the locator you use.
You can use select locator
dropdown to select corresponding locator type
|
MoveSlider [Space]<"Value for Slider to select">
[Space]"<Locator Type><:><Object>"
|
MoveSlider "40" "Xpath://*[@id='lst-ib']"
|
NavigateURL
|
NavigateURL is used to navigate to URL from active web page
NavigateURL can work with one URL at a time.
|
NavigateURL[Space]"URL"[Space]"null"
|
NavigateURL "www.gmail.com" "null"
|
NavigateBack
|
NavigateBack is used to perfrom browser back button
|
NavigateBack[Space]"null"[Space]"null"
|
NavigateBack "null" "null"
|
NavigateForward
|
NavigateForward is used to perfrom browser forward button
|
NavigateBack[Space]"null"[Space]"null"
|
NavigateForward "null" "null"
|
ObjectSelected
|
ObjectSelected is used to check if given object is selected or not.
If selected test will be passed.
ObjectSelected can check one
object at a time.
ObjectSelected requires the target
object or the locator to identify the object and type of the locator you
used.
You can use select locator
dropdown to select corresponding locator type.
ObjectSelected is useful objects such as Checkbox
|
ObjectSelected [Space]"null"[Space]"<Locator
Type><:><Object>"
|
ObjectSelected "null" "Xpath://*[@id='lst-ib']"
|
Open
|
Open is used to call the browser and open a specific URL.
Open keyword will create a new
instant of a browser.
|
Open[Space]"<URL>"
|
Open "https://www.google.lk/ "
|
ResizeBrowser
|
ResizeBrowser used Resize Running Browser.
You can use value text box to key in Height and Width by separating
them using coma
|
ResizeBrowser[Space]"Hight,Width"
|
ResizeBrowser "100,100"
|
SelectByIndex
|
SelectByIndex is used to select Combo Box or list Box item using
object index
SelectByIndex can select one
item at a time.
SelectByIndex requires the target object or the locator to identify
the Menu Item , Combo box or list Box and type of the locator you use.
You can use select locator
dropdwn to select corresponding locator type.
|
SelectByIndex [Space]<"Index or ID">
[Space]"<Locator Type><:><Object>"
|
SelectByVisibleTextKey "2"
"Xpath://*[@id='lst-ib']"
|
SelectByVisibleTextKey
|
SelectByVisibleTextKey is used to select Combo Box or List Box item
using visible text
SelectByVisibleTextKey can
select one item at a time.
SelectByVisibleTextKey requires the target object or the locator to
identify the Menu Item , Combo box or List Box and type of the locator you
use.
You can use select locator
dropdown to select corresponding locator type.
|
SelectByVisibleTextKey [Space]<"Text value you need to
select"> [Space]"<Locator
Type><:><Object>"
|
SelectByVisibleTextKey "Senuji"
"Xpath://*[@id='lst-ib']"
|
StoreNumberToVariable
|
StoreNmberToVariable is used store number object value to number
variable
StoreNmberToVariable can work
with one object at a time. Variable Name can be any alpha numeric string
without special chars.
Length of the variable is not
limited but you cant have spaces in-between.
You must define the variable
using VariableNumber keyword
|
VariableNumber[Space]"$Varible_Name=initial
value"[Space]"Object or Locator"
|
VariableNumber "$ExpectedPageNO"
"Xpath://*[@id='lst-ib']"
|
StoreStringToVariable
|
StoreStringToVariable is used store string object value to string
variable
StoreStringToVariable can
work with one object at a time. Variable Name can be any alpha numeric string
with out special chars.
Length of the variable is not
limited but you cant have spaces in-between.
You must define the variable
using VariableSring keyword
|
VariableNumber[Space]"$Varible_Name=initial
value"[Space]"Object or Locator"
|
VariableNumber "$ExpectedPageTitle"
"Xpath://*[@id='lst-ib']"
|
Submit
|
Submit is used to perform submit action on a web form
Submit requires the target object or the locator.
You can use select locator
dropdown to select corresponding locator type.
|
Submit[Space]"null"[Space]"Object"
|
Submit "null"Xpath://*[@id='lst-ib']"
|
ValidateObjactValue
|
ValidateObjactValue is used to search a static value in
object/target.
ValidateObjactValue can
search values for one object at a time.
ValidateObjactValue requires the target object or the locator to
identify the object and type of the locator you use.
You can use select locator
dropdown to select corresponding locator type.
|
ValidateObjactValue [Space]<"Search value">
[Space]"<Locator Type><:><Object>"
|
ValidateObjactValue "I like Senuji"
"Xpath://*[@id='lst-ib']"
|
VariableNumber
|
VariableNumber is used create numaric variable
VariableNumber can work with
one variable at a time. Variable Name can be any alpha numeric string without
special chars.
Length of the varible is not
limited but you cant have spaces in-between.
You must provide initial value
for the variable
|
VariableNumber[Space]"$Varible_Name=initial
value"[Space]"null"
|
VariableNumber "$ExpectedPageNO=10" "null"
|
VariableSring
|
VariableSring is used create String variable
VariableSring can work with
one variable at a time. Variable Name can be any alpha numeric string without
special chars.
Length of the variable is not
limited but you cant have spaces in between.
You must provide initial value
for the varible
|
VariableSring[Space]"$Varible_Name=initial
value"[Space]"null"
|
VariableSring "$ExpectedPageTitle=My Page Title"
"null"
|
VerifyTxtBoxValue
|
VerifyTxtBoxValue is used to read value form textbox and verify with
expected value
VerifyTxtBoxValue can search
values for one textbox at a time.
ValidateObjactValue requires the target object or the locator to
identify the test box and type of the locator you use.
You can use select locator
dropdown to select corresponding locator type.
|
VerifyTxtBoxValue [Space]<"Search value">
[Space]"<Locator Type><:><Object>"
|
VerifyTxtBoxValue "I like Senuji"
"Xpath://*[@id='lst-ib']"
|
Wait
|
Pause process
|
Wait[Space]"<Wait Time in ms"
|
Wait "3000"
|
WaitForElementPresent
|
WaitForElementPresent is used to check for an object in a web page.
WaitForElementPresent can
validate one object at a time.
WaitForElementPresent requires
the target object or the locator to identify the test box and type of the
locator you use.
You can use select locator
dropdown to select corresponding locator type.
|
WaitForElementPresent [Space]"null"[Space]"<Locator
Type><:><Object>"
|
WaitForElementPresent "nill"
"Xpath://*[@id='lst-ib']"
|
|
|
|
|
|
|
|
|