yanthink/browser

模拟浏览器

dev-master 2018-07-10 07:17 UTC

This package is not auto-updated.

Last update: 2024-11-20 10:35:00 UTC


README

安装

  1. 打开终端执行下面命令:
composer require yanthink/browser
  1. 使用
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Yanthink\Browser\Browser;
use Yanthink\Browser\Simulation;

class Test extends Command
{
    public function handle(Simulation $simulation)
    {
        $simulation->browse(function (Browser $browser) {
            $browser->visit('http://localhost/foo')
                ->waitFor('#pass')
                ->type('pass', 'password')
                ->click('#sub')
                ->dump();
        });
    }
}