public function get_value() {

        // Wait until DOM and JS is ready.
        $this->session->wait(behat_base::get_timeout(), behat_base::PAGE_READY_JS);

        // Get the label to restrict the files to this single form field.
        $fieldlabel = $this->get_field_locator();

        // Get the name of the current directory elements.
        $xpath = "//label[contains(., '" . $fieldlabel . "')]" .
            "/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')]" .
            "/descendant::div[@data-fieldtype = 'filemanager']" .
            "/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-filename ')]";

        // We don't need to wait here, also we don't have access to protected
        // contexts find* methods.
        $files = $this->session->getPage()->findAll('xpath', $xpath);

        if (!$files) {
            return '';
        }

        $filenames = array();
        foreach ($files as $filenode) {
            $filenames[] = $filenode->getText();
        }

        return implode(',', $filenames);
    }