https://github.com/kamalkhan/web-browser
Programmatically navigate/test the web using php. A convenience wrapper around laravel/dusk.
https://github.com/kamalkhan/web-browser
browser dusk laravel testing web
Last synced: 3 months ago
JSON representation
Programmatically navigate/test the web using php. A convenience wrapper around laravel/dusk.
- Host: GitHub
- URL: https://github.com/kamalkhan/web-browser
- Owner: kamalkhan
- License: mit
- Created: 2021-06-11T17:40:05.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-23T12:09:07.000Z (about 5 years ago)
- Last Synced: 2025-02-02T22:34:46.654Z (over 1 year ago)
- Topics: browser, dusk, laravel, testing, web
- Language: PHP
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Web Browser [![Build Status][icon-status]][link-status] [![Total Downloads][icon-downloads]][link-downloads] [![MIT License][icon-license]](LICENSE.md)
Programmatically navigate/test the web.
- [Requirements](#requirements)
- [Install](#install)
- [Install chrome driver](#install-chrome-driver)
- [Install phantomjs driver](#install-phantomjs-driver)
- [Usage](#usage)
- [Chrome](#chrome)
- [Phantomjs](#phantomjs)
- [API](#api)
- [Example](#example)
- [Testing](#testing)
- [PHPUnit](#phpunit)
- [Changelog](#changelog)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [License](#license)
## Requirements
- PHP >= 7.2
## Install
You may install this package using [composer][link-composer].
```shell
$ composer require bhittani/web-browser
```
### Install chrome driver
```shell
$ vendor/bin/install-chrome-driver
```
### Install phantomjs driver
```shell
$ vendor/bin/install-phantomjs-driver
```
## Usage
This package conveniently wraps [laravel/dusk](https://github.com/laravel/dusk).
### Chrome
First ensure you have installed the [chrome driver](#install-chrome-driver).
```php
visit('https://example.com')->assertSee('Example');
```
### Testing
We can also make assertions and capture failures within a testing environment.
```php
visit('https://example.com')->assertSee('Example');
$browser2->visit('https://example.net')->assertSee('Example');
});
Phantomjs::test(/*...*/);
Testing::tearDown(); // Required for closing all browsers.
```
> The above test callback will capture any failed assertions by taking a screenshot, save the console log and the source of a web page that caused the failure.
#### PHPUnit
A `TestCase` class and a `TestTrait` trait under the `Bhittani\WebBrowser` namespace is included for making it easy to write your browser tests using `PHPUnit`.
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed.
## Testing
```shell
$ git clone https://github.com/kamalkhan/web-browser
$ cd web-browser
$ composer install
$ composer install-drivers
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
## Security
If you discover any security related issues, please email `shout@bhittani.com` instead of using the issue tracker.
## Credits
- [Kamal Khan](http://bhittani.com)
- [All Contributors](https://github.com/kamalkhan/web-browser/contributors)
## License
The MIT License (MIT). Please see the [License File](LICENSE.md) for more information.
[icon-status]: https://img.shields.io/github/workflow/status/kamalkhan/web-browser/main?style=flat-square
[link-status]: https://github.com/kamalkhan/web-browser
[icon-downloads]: https://img.shields.io/packagist/dt/bhittani/web-browser.svg?style=flat-square
[link-downloads]: https://packagist.org/packages/bhittani/web-browser
[icon-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[link-composer]: https://getcomposer.org