Skip to content

Commands

Julien Gidel edited this page Mar 28, 2021 · 19 revisions

This page present you all command with the associated pattern working with each one.

All commands (45)

Details

This part details all pattern to use with example. You can understand how patterns work here

alert

Action on javascript alert

['alert' => [
    'type'=>':string :in("accept", "dismiss", "isPresent", "sendKeys")',
    'value?'=>':string'
]]

Example :

- alert : 
    type: accept
- alert:
    type: sendKeys
    value: example command

click

Click on the specified element

['click' => [
    ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string']
]

Example :

- click : 
    id: myElement

close

Close the current window

['close' => 'window']

Example :

- close : window

condition

Make a derivation on scenario based on a condition. This condition can be answered by a Logic class.

['condition'=> [
    ':string :in("eval","logic")'=>':string',
    'correct'=>['steps'=>':array'],
    'incorrect'=>['steps'=>':array']
    ]
]

Example :

- condition :
    eval: 'true == false'
    correct:
        steps:
            - go: http://youtube.fr
    incorrect:
        steps:
            - go: http://wikipedia.fr

configuration

Change configuration at runtime

['configuration'=>[
        'wait?'=> [
            'for' => ':string :regexp("/(\d)*/")',
            'every'=> ':string :regexp("/(\d)*/")'
        ]
    ]
]

Example :

- configuration:
    wait:
        for: 30
        every: 250

cookie

Create a cookie

['cookie' => [
    'name'=>':string',
    'value'=>':string'
    ]
]

Example :

- cookie:
    name: MyCookieName
    value: MyCookieValue

create

Create a new tab or window and switchTo it

['create' => ':string :in("tab","window")']

Example :

- create: window

deselect

Deselect the element in a

['deselect'=>
    [
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
        'type'=>':string :in("checkbox", "radio", "select")',
        'by'=>':string :in("value","index","text","pltext")',
        'value'=>':string or (:number :int)'
    ]
]

Example :

- deselect:
    id: mySelect
    type: select
    by: value
    value: 'Yes'

exit

Exit the scenario and throw an error with the specified message

['exit'=>':string']

Example :

- exit: Scenario exit

fill

Fill the element with text

['fill' => [
    ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
    'with' => ':string',
    'before?' => ':string :in("clear")'
    ]
]

Example :

- fill:
    name: element
    with: AutoMate
- fill:
    name: element
    with: AutoMate
    before: clear

form

Can submit a specific form

['form'=>[
    ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
    'type'=>':string :in("submit")'
]]

Example :

- form:
    id: myForm
    type: submit

frame

Switch to a frame or iFrame

['frame'=>[
    ':string :in("css","xpath","id","class","name","tag","linktext", "pltext") ?'=>':string',
    'index?'=>':number',
    'default?'=>'content'
]]

Example :

- frame:
    id: myIFrame

get

Get a value in an element and store it in Word scope variable with name varname. Call it with {{ world.varname }}

['get' =>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
        'what'=>':string :in("text","attribute")',
        'attribute?'=>':string',
        'varname'=>':string'
    ]
]

Example :

- get:
    id: element
    what: text
    varname: textElement
- get:
    id: element
    what: attribute
    attribute: data-index
    varname: attributeElement

go

Go to the adress

['go'=>':string :url']

Example :

- go: http://github.fr

impltm (IMPLicit Time Out)

Set up the driver implicit time out.

Prefer explicit timeout by using configuration

['impltm'=>':number']

Example :

- impltm: 40

isClickable

Wait until the element is clickable

['isClickable'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- isClickable:
    id: element

isNotSelected

Wait until the element is not selected

['isNotSelected'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- isNotSelected:
    id: element

isSelected

Wait until the element is selected

['isSelected'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- isSelected:
    id: element

keyboard

Can simulate keyboard actions on active element

['keyboard'=>[
        'event'=> ':string :in("releaseKey","pressKey", "sendKeys")',
        'keys'=> ':any'
    ]
]

Example :

- keyboard:
    event: releaseKey
    keys:
        - key1: 'A'
        - key2: 'M'
- keyboard:
    event: sendKeys
    keys:
        - key1: 'myKeys'

log

Add a message to the message queue

['log'=>':string']

Example :

- log: the message

loop

Run steps for X times

['loop'=> [
        'repeat'=> ':number',
        'steps'=> ':array'
    ]
]

Example :

- loop:
    repeat: 5
    steps:
        - cookie:
            name: myCookie
            value: myValue

mouse

Can simulate mouse actions

['mouse'=>[
    ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
    'event'=> ':string :in("click","doubleClick","mouseDown","mouseUp","mouseMove")'
]]

Example :

- mouse:
    id: element
    event: doubleClick

numberOfWindows

Wait until the number of windows is

['numberOfWindows' => ':number']

Example :

- numberOfWindows: 2

page

Load the page into the PageHandler

['page' => ':string']

Example :

- page: example.index

presenceOfAll

Wait until the presence of all element located

['presenceOfAll'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- presenceOfAll:
    id: myElement

presenceOf

Wait until the presence of a specific element

['presenceOf'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- presenceOf:
    id: myElement

print

Print a text on terminal

['print'=> ':strin']

Example :

- print: 'my text'

reload

Reload the current page

['reload'=>'page']

Example :

- reload: page

resize

Resize the current window

['resize'=>[
        'type'=>':string :in("maximize","fullscreen","size")',
        'size?'=> [
            'width'=>':number',
            'height'=>':number'
        ]
        
    ]
]

Example :

- resize:
    type: maximize
- resize:
    type: size
    size:
        width: 500
        height: 400

screenshot

Take a screenshot

['screenshot' =>[
        'type'=> ':string :in("all","element")',
        'sname'=>':string',
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement") ?'=>':string'
    ]
]

Example :

- screenshot:
    type: element
    sname: myScreenshot.png
    id: myElement
- screenshot:
    type: all
    sname: myScreenshot.png

script

Execute the given script

['script'=>':string']

Example :

- script: 'return 0==1;'

select

Select the element

['select'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
        'by'=>':string :in("value","index","text","pltext")',
        'value'=>':string or (:number :int)'
    ]
]

Example :

- select:
    id: mySelect
    by: index
    value: 0

submit

Fill and submit an element

['submit'=>[
    ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
    'text'=>':string'
]]

Example :

- submit:
    id: myElement
    text: 'Automate'

textContains

Wait until text contains the text

['textContains'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
        'value'=>':string'
    ]
]

Example :

- textContains:
    value: myText
    id: myElement

textIs

Wait until text is the text

['textIs'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
        'value'=>':string'
    ]
]

Example :

- textIs:
    value: myText
    id: myElement

textMatches

Wait until text matches the text

['textMatches'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string',
        'regexp'=>':string'
    ]
]

Example :

- textmatches:
    regexp: '/[a-zA-Z]/'
    id: element

titleContains

Wait until window title contains

['titleContains' => ':string']

Example :

- titleContains: myTitle

titleIs

Wait until window title is

['titleIs' => ':string']

Example :

- titleIs: myTitle

titleMatches

Wait until title matches

['titleMatches' => ':string']

Example :

- titleMatches: '/[a-zA-Z]/'

urlContains

Wait until url contains

['urlContains' => ':string']

Example :

- urlContains: youtube

urlIs

Wait until url is

['urlIs' => ':string']

Example :

- urlIs: https://www.youtube.com

urlMatches

Wait until url matches

['urlMatches' => ':string']

Example :

- urlMatches: 'youtube'

use

Permit to import another scenario. You can use sub to import a scenario that is in the current scenario folder. You can use main to use the main specified scenario (main.yaml)

['use'=>':string']

Example :

- use: main.scenario
- use: sub.mySubScenario

visibilityOfAny

Wait until any element is visible

['visibilityOfAny'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- visibilityOfAny:
    id: myElement

visibilityOf

Wait until the element is visible

['visibilityOf'=>[
        ':string :in("css","xpath","id","class","name","tag","linktext", "pltext", "pageElement")'=>':string'
    ]
]

Example :

- visibilityOf:
    id: myElement

wajax (Wait AJAX)

Wait until an ajax function to execute

['wajax'=>':string']

Example :

- wajax: 'return JQuery.active == 1;'

Clone this wiki locally