PHP code example of athena-oss / php-fluent-webdriver-client

1. Go to this page and download the library: Download athena-oss/php-fluent-webdriver-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/ */

    

athena-oss / php-fluent-webdriver-client example snippets


namespace OLX\SampleWebDriver\Tests;

use OLX\FluentWebDriverClient\Browser\Browser;
use OLX\FluentWebDriverClient\Browser\BrowserDriverBuilder;

class WikipediaBrowserTest extends \PHPUnit_Framework_TestCase
{
    public function testArticlePage_RegularArticleInEnglish_ShouldDisplayArticleTitleAsHeader()
    {
        $driver = (new BrowserDriverBuilder('http://localhost:4444/wd/hub'))
            ->withType('phantomjs')
            ->build();

        $browser = new Browser($driver);

        $browser->get('https://en.wikipedia.org/wiki/Athena')
            ->getElement()
            ->withCss('h1#firstHeading')
            ->assertThat()
            ->isHidden()
            ->thenFind()
            ->asHtmlElement();
    }
}

namespace OLX\SampleWebDriver\Tests;

use OLX\FluentWebDriverClient\Browser\Browser;
use OLX\FluentWebDriverClient\Browser\BrowserDriverBuilder;

class WikipediaBrowserTest extends \PHPUnit_Framework_TestCase
{
    public function testArticlePage_RegularArticleInEnglish_ShouldDisplaySpecialHeaderAfter3Seconds()
    {
        $driver = (new BrowserDriverBuilder('http://localhost:4444/wd/hub'))
            ->withType('phantomjs')
            ->build();

        $browser = new Browser($driver);

        $browser->get('https://en.wikipedia.org/wiki/Athena')
            ->getElement()
            ->withCss('h1#specialHeading')
            ->wait(3)
            ->toBeVisible()
            ->thenFind()
            ->asHtmlElement();
    }
}