Почему эти ошибки исходят от casperjs?

Я использую Laravel и хочу использовать Casperjs. Но установка кажется неправильной

-Шаги, за которыми я следовал

  1. (https://packagist.org/packages/jerome-breton/casperjs-installer)
    • композитор требует jerome-breton / casperjs-installer

Следующий,

  1. (https://packagist.org/packages/phpcasperjs/phpcasperjs)
    • композитор требует команду phpcasperjs / phpcasperjs

а также

Я написал следующий код в моем контроллере

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Browser\Casper;

class TestController extends Controller
{
private static $casperBinPath = '/usr/local/bin/';

public static function setUpBeforeClass()
{
if (!file_exists(self::$casperBinPath . 'casperjs')) {
self::$casperBinPath = 'node_modules/casperjs/bin/';
}
}

public function testStart_onGoogleSearchPage()
{
$casper = new Casper(self::$casperBinPath);

$casper->start('http://www.google.com');
$casper->fillForm(
'form[action="/search"]',
array(
'q' => 'search'
),
true);
$casper->click('h3.r a');
$casper->run();

$this->assertTrue(is_array($casper->getOutput()));
$this->assertTrue(sizeof($casper->getOutput()) > 0);
$this->assertNotNull($casper->getCurrentUrl());
}
}

После этого я пошел в http://127.0.0.1/test/public/
но я получил эту ошибку Неправильная установка?

tempnam (): file created in the system's temporary directory

C:\Bitnami\wampstack-7.1.20-
0\apache2\htdocs\test\vendor\phpcasperjs\phpcasperjs\src\Casper.php
$output = array();

$fragment = <<<FRAGMENT
casper.then(function () {
this.echo('$this->TAG_CURRENT_URL' + this.getCurrentUrl());
this.echo('$this->TAG_CURRENT_TITLE' + this.getTitle());
this.echo('$this->TAG_CURRENT_PAGE_CONTENT' +
this.getPageContent().replace(new RegExp('\\r?\\n','g'), ''));
this.echo('$this->TAG_CURRENT_HTML' + this.getHTML().replace(new RegExp('\\r?
\\n','g'), ''));
this.echo('$this->TAG_CURRENT_HEADERS' +
JSON.stringify(this.currentResponse.headers));
this.echo('$this->TAG_CURRENT_STATUS' + this.currentResponse.status);
this.echo('$this->TAG_CURRENT_STATUS_TEXT' +
this.currentResponse.statusText);
this.echo('$this->TAG_CURRENT_COOKIES' + JSON.stringify(phantom.cookies));
});

casper.run();

FRAGMENT;

$this->script .= $fragment;
$filename = tempnam($this->tempDir, 'php-casperjs-');  <<-- red color (error)

file_put_contents($filename, $this->script);

// options parsing
$options = '';
foreach ($this->options as $option => $value) {
$options .= ' --' . $option . '=' . $value;
}

exec($this->path2casper . 'casperjs ' . $filename . $options, $output);
if (empty($output)) {
throw new \Exception('Can not find CasperJS.');
}

$this->setOutput($output);
$this->processOutput();

unlink($filename);

return $output;
Arguments
"tempnam(): file created in the system's temporary directory"

Пожалуйста, дайте мне совет.

3

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector