peridot-php/webdriver-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

peridot-php/webdriver-manager

Composer 安装命令:

composer require --dev peridot-php/webdriver-manager

包简介

Library and command line tool for managing Selenium WebDriver

README 文档

README

Build Status Scrutinizer Code Quality

The perfect companion for projects with functional tests. Heavily inspired by the webdriver-manager that ships with protractor. WebDriver Manager allows you to keep Selenium Server binaries up to date. It also provides a packaged solution for easily starting Selenium Server.

In addition to an easy to use command line application, WebDriver Manager provides a library for managing Selenium binaries in your own apps and tools.

Installation

WebDriver Manager is meant to be a drop in installation for any project using Selenium WebDriver for functional tests.

$ composer require --dev peridot-php/webdriver-manager

Once installed, you can operate Selenium Server from the comfort of your project:

$ vendor/bin/manager start

Usage

WebDriver Manager Usage

clean

Remove all installed binaries.

WebDriver clean command

status

List all available binaries and their installed status. Status shows if the binary is installed, out of date, or missing.

WebDriver status command

update

The update command downloads current binaries and deletes old ones.

WebDriver update command

start

Starts Selnium Server with all drivers managed by WebDriver Manager. The start command will run an update at start to make sure drivers are available and up to date.

WebDriver start command

Library Usage

WebDriver manager exposes a really simple interface that makes it easy to leverage in your own applications and tools:

use Peridot\WebDriverManager\Manager;

$manager = new Manager();

$manager->update(); //update all binaries
$manager->update('selenium'); //only update selenium

$manager->clean(); //remove installed binaries

$manager->startInForeground(); //start selenium in the foreground on port 4444
$manager->startInForeground(9999); //start selenium in the foreground on port 9999
$manager->startInBackground(); //start selenium in the background on port 4444
$manager->startInBackground(9999); //start in the background on port 9999 

$path = $manager->getInstallPath(); //where binaries are installed
$manager->setInstallPath(__DIR__); //set the path to install binaries

$manager->addBinary(new MyCustomDriver()); //add a binary to manage
$manager->removeBinary('chromdedriver'); //remove a managed binary
$binaries = $manager->getBinaries(); //get a collection of managed binaries

A note on starting Selenium in the background

WebDriver Manager does not block when starting a background process. This makes it difficult to see if Selenium encountered any errors (perhaps a corrupt binary?). The SeleniumProcess class provides a method for checking the status of the process. If you want to check that Selenium Server started in the background ok, you might try something like this:

$process = $manager->startInBackground();
usleep(250000); //give Selenium a quarter of a second to validate input
if (! $process->isRunning()) {
	//Selenium encountered an error
	print $process->getError();
	$process->close();
    return;
}

//do rad Selenium things

For more information, see the API docs;

Examples

The API has been used to create a custom Behat listener capable of starting the server before Mink tests are run. This tool is included as part of a demo project known as behavior driven todos.

Running Tests

WebDriver Manager's tests were written using the Peridot test framework.

Unit tests can be run like so:

$ vendor/bin/peridot

And integration tests can be run like this:

$ vendor/bin/peridot --grep *.it.php

Contributing

Please feel free to open issues or pull requests.

peridot-php/webdriver-manager 适用场景与选型建议

peridot-php/webdriver-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35.42k 次下载、GitHub Stars 达 35, 最近一次更新时间为 2015 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「testing」 「selenium」 「webdriver」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 peridot-php/webdriver-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 peridot-php/webdriver-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 peridot-php/webdriver-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 35.42k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 35
  • 点击次数: 20
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 35
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-17