bhittani/web-driver

A convenience wrapper around facebook's php-webdriver

0.6.0 2021-06-07 14:26 UTC

This package is auto-updated.

Last update: 2024-12-07 22:34:37 UTC


README

Run and/or control a web driver programmatically.

Requirements

  • PHP >= 5.6.4

Install

You may install this package using composer.

$ composer require bhittani/web-driver --prefer-dist

Install chrome driver

$ vendor/bin/install-chrome-driver

Install phantomjs driver

$ vendor/bin/install-phantomjs-driver

Usage

This package conveniently wraps the Facebook's PHP Web Driver and by default offers drivers for chrome and phantomjs.

Chrome Web Driver

First ensure you have installed the chrome driver.

<?php

use Bhittani\WebDriver\Chrome;

$driver = Chrome::make();

Phantomjs Web Driver

First ensure you have installed the phantomjs driver.

<?php

use Bhittani\WebDriver\Phantomjs;

$driver = Phantomjs::make();

API

All driver instances extend Facebook\WebDriver\Remote\RemoteWebDriver, hence, the same API applies.

Example

<?php

$googleDotCom = $driver->get('https://google.com');

$googleDotCom->getTitle(); // 'Google'

Advanced

TODO

  • Document the usage of process.
  • Document the usage of custom ports.
  • Document the usage of payload (chrome)

Changelog

Please see CHANGELOG for more information on what has changed.

Testing

$ git clone https://github.com/kamalkhan/web-driver

$ cd web-driver

$ composer install

$ composer install-drivers

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email shout@bhittani.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see the License File for more information.