fonsecas72/selenium-handler
Composer 安装命令:
composer require fonsecas72/selenium-handler
包简介
Get, Start & Stop selenium server
README 文档
README
Download, Start & Stop Selenium Server with PHP >= 5.4 as a kind of a client or by command line.
This package was written to avoid downloading selenium by hand and to avoid those complex commands to make selenium to start. It also allows you to use it with-in your own package.
Installation
With Composer:
composer require --dev fonsecas72/selenium-handler
Usage
In your application
You can create a downloader, a starter, a stopper and a watcher. E.g. to create a starter:
$seleniumStarterOptions = new SeleniumStartOptions(); $process = new Process(''); $exeFinder = new ExecutableFinder(); $waiter = new ResponseWaitter(new Client()); $starter = new SeleniumStarter($seleniumStarterOptions, $process, $waiter, $exeFinder);
Then you can call:
$starter->start();
And it will just work.
Of course, you can also change de default settings. This is done by calling options classes that each one if this has. E.g. to change a setting for the starter:
// timeout is changed in the "waitter" class: $starter->getResponseWaitter()->setTimeout($input->getOption('timeout')); // to set a specific selenium location you do: $starterOptions = $starter->getStartOptions(); $starterOptions->setSeleniumJarLocation($input->getOption('selenium-location')); // to enable xvfb: $starterOptions->enabledXvfb();
You can also create a "handler" that will allow you to start, stop, download, etc. through one single class.
$this->handler = new SeleniumHandler($starter, $stopper, $downloader, $logWatcher);
see the tests and the built-in commands for more examples, or open an issue
Built-in commands
get selenium
(it will download to current directory by default)
bin/selenium get
You can set the destination directory with
bin/selenium get -d someDir/
You can set the selenium version with
bin/selenium get -s 2.44
start selenium
bin/selenium start
You can give the selenium location with
bin/selenium start --selenium-location /someDir/selenium-server-standalone.jar
Optionally, you may choose whether or not you want to use xvfb
bin/selenium start --xvfb
You can throw selenium options too. For example: You can set the firefox profile to use:
bin/selenium start --selextra firefox-profile=/someDir/toFirefoxProfile
You can also set how much you are willing to wait for selenium to start (in seconds)
bin/selenium start --timeout 60
stop selenium
bin/selenium stop
Tips & Tricks
You can also tail the selenium log after start with follow option:
bin/selenium start --follow
You can even track a specific log level
bin/selenium start --follow ERROR
This can be specially useful if you start selenium in the background before running tests.
bin/selenium start --follow ERROR &
Then if some error happens you will see it in your test log / output.
fonsecas72/selenium-handler 适用场景与选型建议
fonsecas72/selenium-handler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44.59k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 03 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「selenium」 「download」 「get」 「start」 「handle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fonsecas72/selenium-handler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fonsecas72/selenium-handler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fonsecas72/selenium-handler 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The NzoFileDownloaderBundle is a Symfony Bundle used to Download all types of files from servers and Web applications safely and with ease. You can also read/show the file content in the Web Browser.
Adds a download link next to assets
Selenium4 (WebDriver) driver for Mink framework
PHP Library for Selenium
Selenium driver for Mink framework
Get Address IO wrapper covering all endpoints available from the API.
统计信息
- 总下载量: 44.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-11