behat/mink-selenium2-driver
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
instaclick/php-webdriver | 1.4.19 | - | Apache-2.0 | prod |
The behat/mink-selenium2-driver
package serves as a Selenium2 (WebDriver) driver for the Mink framework. It is a vital part of website testing as it lets your PHP application interact with a web browser, just like a human would. This package allows automated browser interactions in your PHP application, beneficial for creating automated tests for your web-based software.
The use of behat/mink-selenium2-driver
in your PHP application enables automated interaction with your web browser. To utilize it, you need to first install it via Composer by adding the following to your composer.json
:
{
"require": {
"behat/mink": "~1.5",
"behat/mink-selenium2-driver": "~1.1"
}
}
After saving your composer.json
file, just run php composer.phar install
in your terminal.
Once the package has been installed, you can use it in your PHP scripts. Here's a simple code example:
<?php
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\Selenium2Driver;
use Selenium\Client as SeleniumClient;
$browser = 'firefox';
$url = 'http://example.com';
$mink = new Mink(array(
'selenium2' => new Session(new Selenium2Driver($browser, null, $url)),
));
$mink->getSession('selenium2')->getPage()->findLink('Chat')->click();
In this code sample, we initiated a new Mink session with the Selenium2Driver. We targeted a Firefox browser and the URL of the page to test. Finally, we used the findLink('Chat')->click()
function to simulate the action of locating a link labeled 'Chat' on the page and clicking it.
The official documentation for using the behat/mink-selenium2-driver
is provided directly in its GitHub repository under the README file. Found at https://github.com/minkphp/MinkSelenium2Driver, this documentation includes a comprehensive instruction guide on the functionalities of the package, usage examples, and additional details related to installation, testing, and contributors. It is important to refer to this documentation for complete understanding and proficient use of this package. Remember, clear and precise instructions from well-crafted documentation enables optimal use of the driver, elevating the overall success of your project.