src/DrupalExtension/Context/DrupalContext.php
public function manuallyCreateNodes($type, TableNode $nodesTable) {
    $type = $this->getCore()->convertLabelToNodeTypeId($type);

    foreach ($nodesTable->getHash() as $nodeHash) {
      $this->getSession()->visit($this->locatePath("/node/add/$type"));
      $element = $this->getSession()->getPage();
      // Fill in the form.
      foreach ($nodeHash as $field => $value) {
        $element->fillField($field, $value);
      }
      $submit = $element->findButton($this->getDrupalText('node_submit_label'));
      if (empty($submit)) {
        throw new \Exception(sprintf("No submit button at %s", $this->getSession()->getCurrentUrl()));
      }
      // Submit the form.
      $submit->click();
    }

  }
public function manuallyCreateNodes($type, TableNode $nodesTable) {
    $type = $this->getCore()->convertLabelToNodeTypeId($type);

    foreach ($nodesTable->getHash() as $nodeHash) {
      $this->getSession()->visit($this->locatePath("/node/add/$type"));
      $element = $this->getSession()->getPage();
      // Fill in the form.
      foreach ($nodeHash as $field => $value) {
        $element->fillField($field, $value);
      }
      $submit = $element->findButton($this->getDrupalText('node_submit_label'));
      if (empty($submit)) {
        throw new \Exception(sprintf("No submit button at %s", $this->getSession()->getCurrentUrl()));
      }
      // Submit the form.
      $submit->click();
    }

  }
public function manuallyCreateNodes ( $ type , TableNode $ nodesTable ) { $ type = $ this -> getCore ( ) -> convertLabelToNodeTypeId ( $ type ) ; foreach ( $ nodesTable -> getHash ( ) as $ nodeHash ) { $ this -> getSession ( ) -> visit ( $ this -> locatePath ( "/node/add/$type" ) ) ; $ element = $ this -> getSession ( ) -> getPage ( ) ; // Fill in the form. foreach ( $ nodeHash as $ field => $ value ) { $ element -> fillField ( $ field , $ value ) ; } $ submit = $ element -> findButton ( $ this -> getDrupalText ( 'node_submit_label' ) ) ; if ( empty ( $ submit ) ) { throw new \ Exception ( sprintf ( "No submit button at %s" , $ this -> getSession ( ) -> getCurrentUrl ( ) ) ) ; } // Submit the form. $ submit -> click ( ) ; } }
Creates content by filling specified form fields via the UI.

Use as follow:

| Title    | Author     | Label | of the field      |
| My title | Joe Editor | 1     | 2014-10-17 8:00am |
| ...      | ...        | ...   | ...               |

@Given I create :type content:
Creates content by filling specified form fields via the UI .