项目作者: highscoresl

项目描述 :
Laravel dusk extensions
高级语言: PHP
项目地址: git://github.com/highscoresl/browser.git
创建时间: 2019-07-24T10:03:18Z
项目社区:https://github.com/highscoresl/browser

开源协议:

下载


Laravel dusk browser macros

This packages adds several methods to the laravel dusk browser.
Also makes easy to instance a new browser with a builder pattern.

Instalation

  1. composer require highscore/browser

Usage

  1. <?php
  2. use Laravel\Dusk\Browser;
  3. $browser = Browser::configure()
  4. ->headless()
  5. ->singleProcess()
  6. ->host('http://127.0.0.1')
  7. ->port(9515)
  8. ->enableRequestLog()
  9. ->storeScreenshotsAt(storage_path('app/'))
  10. ->size(1280, 720)
  11. ->agent('MyCustomAgent 1.0')
  12. ->proxy('http://proxyurl:9510')
  13. ->allowDownloadsTo('/tmp')
  14. ->grantAllPermisions('http://www.google.com')
  15. ->lang('es')
  16. ->make();
  17. dump($browser->visit('http://www.google.com')
  18. ->javascript('return document.title'));
  19. $browser
  20. ->waitDocumentLoad()
  21. ->waitFontLoad()
  22. ->waitForVisible('//img')
  23. ->waitForClickable('button')
  24. ->transparentScreenshot('transparent-screenshot');
  25. dump($browser->getNetworkEvents());
  26. dump($browser->html());

Running tests

Start a chromedriver on 127.0.0.1:9515 and run phpunit