Interacting with Pages

Most usages of Mink will involve working with the page opened in your browser. The Mink Element API lets you interact with elements of the page.

Interacting with Forms

The NodeElement class has a set of methods allowing interaction with forms:


gets the value of a form field. The value depends on the type of field:

  • the value of the selected option for single select boxes (or null when none are selected);
  • an array of selected option values for multiple select boxes;
  • the value of the checkbox field when checked, or null when not checked;
  • the value of the selected radio button in the radio group for radio buttons;
  • the value of the field for textual fields and textareas;
  • an undefined value for file fields (because of browser limitations).

sets the value of a form field

  • for a file field, it should be the absolute path to the file;
  • for a checkbox, it should be a boolean indicating whether it is checked;
  • for other fields, it should match the behavior of getValue.
reports whether a radio button or a checkbox is checked.
reports whether an <option> element is selected.
checks a checkbox field.
unchecks a checkbox field.
select an option in a select box or in a radio group.
attaches a file in a file input.
submits the form.

Interacting with the Mouse

The NodeElement class offers a set of methods allowing interaction with the mouse:

performs a click on the element.
performs a double click on the element.
performs a right click on the element.
moves the mouse over the element.

Interacting with the Keyboard

Mink lets you interact with the keyboard thanks to the NodeElement::keyDown, NodeElement::keyPress and NodeElement::keyUp methods.

Manipulating the Focus

The NodeElement class lets you give and remove focus on the element thanks to the NodeElement::focus and NodeElement::blur methods.


Mink supports drag’n’drop of one element onto another:

$dragged = $page->find(...);
$target = $page->find(...);


Shortcut Methods

The TraversableElement class provides a few shortcut methods that allow finding a child element on the page and performing an action on it immediately:

Looks for a link (see findLink) and clicks on it.
Looks for a button (see findButton) and presses on it.
Looks for a field (see findField) and sets a value in it.
Looks for a checkbox (see findField) and checks it.
Looks for a checkbox (see findField) and unchecks it.
Looks for a select or radio group (see findField) and selects a choice in it.
Looks for a file field (see findField) and attaches a file to it.


All these shortcut methods throw an ElementNotFoundException if the child element cannot be found.