Show Menu

Selenium-Codeception Cheat Sheet (DRAFT) by [deleted]

Some useful tips for selenium with codeception

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Codece­ption usage

vendor­/bi­n/c­odecept run
running all tests --steps
show all steps of the tests tests/­acc­ept­anc­e/x­xx.php
launch a unique test suite


what the test is gonna do
what we're trying to do
where we want to go
these are basics content the we want to see in all tests.


Search a text on the page
search an element on the page
search a text in the title of the page
search if text can't be found in the page
There is a lot of others assert­ions. For checking the others assert­ions, just use the autoco­mpl­etion of your IDE with


take a screenshot and save it.
Move back in the history
Move forward in the history
$I->pr­ess­Key­($e­lement, $key)
Press the
on the selected element
Reload page

DOM Manipu­lation

Simulate the click on an element
$I->fi­llF­iel­d($­ele­ment, $value)
Fill a field with a value
$I->se­lec­tOp­tio­n($­ele­ment, $value)
Select an element in a select
$I->dr­agA­ndD­rop­($e­lem­ent1, $element2)
Drag an element on an other
$I->sc­rol­lTo­($e­lement, $x, $y)
Scroll to the middle of an element, with an offset of x - y


Wait X seconds
$I->wa­itF­orE­lem­ent­Vis­ibl­e($­ele­ment, $timeout)
Wait until the element is visible
$I->wa­itF­orE­lem­ent­Not­Vis­ibl­e($­ele­ment, $timeout)
Wait until the element is no longer visible
$I->wa­itF­orJ­S($­jav­asc­ript; $timeout)
Wait until the Js return
$I->wa­itF­orT­ext­($text; $timeout)
Wait until the text is found on the page
These function can be use for waiting a Ajax call for example or where the applic­ation is still loading.