wkse / browserstack

该软件包最新版本(0.0.7)没有可用的许可证信息。

Browserstack截图API的客户端库

0.0.7 2016-09-16 21:23 UTC

This package is not auto-updated.

Last update: 2019-03-12 13:06:44 UTC


README

基于alexschwarz89的Browserstack

Browserstack Screenshots API的一个易于使用的PHP库。包含工作示例。

安装

通过composer安装

{
    "require": {
        "wkse\browserstack": "0.0.3"
    }
}

运行composer install

示例用法

获取可用浏览器的数组

use wkse\browserstack\Screenshots\Api;
$api         = new Api('username', 'password');
$browserList = $api->getBrowsers();

生成截图

use wkse\browserstack\Screenshots\Api;
use wkse\browserstack\Screenshots\Request;
$api        = new Api('account', 'password');
$request    = Request::buildRequest('http://www.google.com', 'Windows', '8.1', 'ie', '11.0');
$response   = $api->sendRequest( $request );
$jobId      = $response->jobId;

查询请求信息

$status = $api->getJobStatus('browserstack_jobid');
if ($status->isFinished()) {
  foreach ($status->finishedScreenshots as $screenshot) {
    print $screenshot->image_url ."\n";
  }
}