Php 未知错误:无法使用Symfony Panther在Laravel中为用户数据目录创建临时目录
我正在使用Symfony Panther和Laravel框架。我使用这个时出错了 未知错误:无法为用户数据目录创建临时目录 {“异常”:“[对象] (Facebook\WebDriver\Exception\UnknownErrorException(代码:0): 我已经安装了适用于Windows 7.4.2的XAMPP。 PHP:7.4.2,Apache:2.4.41 composer.jsonPhp 未知错误:无法使用Symfony Panther在Laravel中为用户数据目录创建临时目录,php,laravel,windows,selenium-webdriver,symfony-panther,Php,Laravel,Windows,Selenium Webdriver,Symfony Panther,我正在使用Symfony Panther和Laravel框架。我使用这个时出错了 未知错误:无法为用户数据目录创建临时目录 {“异常”:“[对象] (Facebook\WebDriver\Exception\UnknownErrorException(代码:0): 我已经安装了适用于Windows 7.4.2的XAMPP。 PHP:7.4.2,Apache:2.4.41 composer.json "require": { "php": "^7.1.3", "fa
"require": {
"php": "^7.1.3",
"fabpot/goutte": "^3.2",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "~6.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0",
"symfony/css-selector": "^4.4",
"symfony/http-client": "^4.4",
"symfony/panther": "^0.7.0"
}
拉威尔控制器类
[2020-02-27 16:12:21]本地。错误:未知错误:无法创建临时
用户数据目录的目录{“异常”:“[对象]
(Facebook\WebDriver\Exception\UnknownErrorException(代码:0):
未知错误:无法在上为用户数据目录创建临时目录
D:\WWW\PHP\myproject\vendor\PHP webdriver\webdriver\lib\Exception\WebDriverException.PHP:139)
%TEMP%
和%TMP%
环境变量并确保它们存在。(为此,请在Windows的命令行上运行echo%TEMP%
和echo%TMP%
)试着删除你的供应商文件,然后重新安装你的依赖项。我已经检查了上面的内容。但是我还是收到了同样的错误。
namespace App\Http\Controllers;
include (base_path() .'/vendor/autoload.php');
use Illuminate\Http\Request;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\HttpClient\HttpClient;
class PageController extends Controller
{
public function myFunction(Request $request)
{
$client = \Symfony\Component\Panther\Client::createChromeClient();
$client->request('GET', 'https://api-platform.com'); // Yes, this website is 100% written in JavaScript
$client->clickLink('Support');
// Wait for an element to be rendered
$crawler = $client->waitFor('.support');
echo $crawler->filter('.support')->text();
}
}