PHP code example of xi / test-selenium

1. Go to this page and download the library: Download xi/test-selenium 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/ */

    

xi / test-selenium example snippets



use \Xi\Test\Selenium\SeleniumServer,
    \Xi\Test\Selenium\WebDriver;

// An autoloader with the proper search paths is assumed

$server = new SeleniumServer('http://localhost:4444/wd/hub');
$browser = new WebDriver($server);
$browser->visit('/index');
$browser->findByLabel('Username')->fillIn('john');
$browser->findByLabel('Password')->fillIn('shepard');
$browser->find('form#login button[type=submit]')->click();
$browser->waitForText('Welcome john');
$browser->screenshot('after-login.png');