facebook/webdriver
最新稳定版本:1.7.1
Composer 安装命令:
composer require facebook/webdriver
包简介
A PHP client for Selenium WebDriver
关键字:
README 文档
README
Description
Php-webdriver library is PHP language binding for Selenium WebDriver, which allows you to control web browsers from PHP.
This library is compatible with Selenium server version 2.x, 3.x and 4.x.
The library supports JsonWireProtocol and also implements experimental support of W3C WebDriver. The W3C WebDriver support is not yet full-featured, however it should allow to control Firefox via Geckodriver and new versions of Chrome and Chromedriver with just a slight limitations.
The concepts of this library are very similar to the "official" Java, .NET, Python and Ruby bindings from the Selenium project.
Looking for API documentation of php-webdriver? See https://facebook.github.io/php-webdriver/
Any complaints, questions, or ideas? Post them in the user group https://www.facebook.com/groups/phpwebdriver/.
Installation
Installation is possible using Composer.
If you don't already use Composer, you can download the composer.phar binary:
curl -sS https://getcomposer.org/installer | php
Then install the library:
php composer.phar require facebook/webdriver
Getting started
Start Server
The required server is the selenium-server-standalone-#.jar file provided here: http://selenium-release.storage.googleapis.com/index.html
Download and run the server by replacing # with the current server version. Keep in mind you must have Java 8+ installed to run this command.
java -jar selenium-server-standalone-#.jar
Create a Browser Session
When creating a browser session, be sure to pass the url of your running server.
// This would be the url of the host running the server-standalone.jar $host = 'http://localhost:4444/wd/hub'; // this is the default url and port where Selenium server starts
Launch Chrome
Install latest Chrome and Chromedriver.
The chromedriver binary must be placed in system PATH directory, otherwise you must provide the path when starting Selenium server
(eg. java -Dwebdriver.chrome.driver="/path/to/chromedriver" -jar selenium-server-standalone-#.jar).
$driver = RemoteWebDriver::create($host, DesiredCapabilities::chrome());
Launch Firefox
Install latest Firefox and Geckodriver.
The geckodriver binary must be placed in system PATH directory, otherwise you must provide the path when starting Selenium server
(eg. java -Dwebdriver.gecko.driver="/path/to/geckodriver" -jar selenium-server-standalone-#.jar).
$driver = RemoteWebDriver::create($host, DesiredCapabilities::firefox());
Customize Desired Capabilities
$desiredCapabilities = DesiredCapabilities::firefox(); $desiredCapabilities->setCapability('acceptSslCerts', false); $driver = RemoteWebDriver::create($host, $desiredCapabilities);
- See https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities for more details.
NOTE: Above snippets are not intended to be a working example by simply copy-pasting. See example.php for working example.
Changelog
For latest changes see CHANGELOG.md file.
More information
Some how-tos are provided right here in our GitHub wiki.
You may also want to check out the Selenium docs and wiki.
Testing framework integration
To take advantage of automatized testing you may want to integrate php-webdriver to your testing framework. There are some projects already providing this:
- Steward integrates php-webdriver directly to PHPUnit, and provides parallelization
- Codeception testing framework provides BDD-layer on top of php-webdriver in its WebDriver module
- You can also check out this blogpost + demo project, describing simple PHPUnit integration
Support
We have a great community willing to help you!
- Via our Facebook Group - If you have questions or are an active contributor consider joining our facebook group and contribute to communal discussion and support
- Via StackOverflow - You can also ask a question or find many already answered question on StackOverflow
- Via GitHub - Another option if you have a question (or bug report) is to submit it here as a new issue
Contributing
We love to have your help to make php-webdriver better. See CONTRIBUTING.md for more information about contributing and developing php-webdriver.
facebook/webdriver 适用场景与选型建议
facebook/webdriver 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 40.17M 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「facebook」 「selenium」 「webdriver」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 facebook/webdriver 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 facebook/webdriver 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 facebook/webdriver 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
Selenium4 (WebDriver) driver for Mink framework
PHP Library for Selenium
Selenium driver for Mink framework
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Contao 4 bundle for a Facebook login.
统计信息
- 总下载量: 40.17M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 38
- 依赖项目数: 110
- 推荐数: 1
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-01-04