yanthink/selenium

dev-master 2018-07-11 10:12 UTC

This package is not auto-updated.

Last update: 2024-11-15 21:59:25 UTC


README

安装

  1. 打开终端执行下面命令:
composer require yanthink/selenium="@dev"
  1. 使用
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Yanthink\selenium\Browser;
use Yanthink\selenium\Selenium;

Selenium::useChromeDriver();
Selenium::enableAutoStartChromeDriver();

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