PHP code example of behat / sahi-client

1. Go to this page and download the library: Download behat/sahi-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

behat / sahi-client example snippets

 bash
    curl -sS https://getcomposer.org/installer | php
    php composer.phar 
 php
    

    iClient\Client;

    $client = new Client();
    $client->start('firefox');
    
 php
    

    $client->navigateTo('http://some_page.loc');

    $link = $client->findLink('Search!');
    $previousLinkText = $link->getText();
    $link->click();

    $h1Text = $client->findHeader(2)->getText();
    
 php
    
    $client->stop();