Selenium assertions in php

We can use Assertion library provided in PHPUnit as shown in below example.
 
<?php

class AssertionTest extends PHPUnit_Framework_TestCase {

protected $webDriver;

public function setUp()
{
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => ‘chrome’);
$this->webDriver = RemoteWebDriver::create(‘https://localhost:4444/wd/hub’, $capabilities);
}

public function tearDown()
{

$this->webDriver->quit();
}

public function testLink()
{
$this->webDriver->get(“https://www.softpost.org/selenium-test-page”);
$this->assertContains(‘Tutorial’, $this->webDriver->getTitle());
$this->assertTrue(‘Selenium Test Page | Free Software Tutorials’==$this->webDriver->getTitle());
$this->assertFalse(‘Selenium Test Page | Free Software Tutorials’!=$this->webDriver->getTitle());
$this->assertEquals(‘Selenium Test Page | Free Software Tutorials’, $this->webDriver->getTitle());
$this->assertSame(‘Selenium Test Page | Free Software Tutorials’, $this->webDriver->getTitle());
$this->assertGreaterThan(2,4,”Verifying that 4 is greater than 2″);
$this->assertGreaterThanOrEqual(2,4,””);
$this->assertLessThan(14,12,””);
$this->assertLessThanOrEqual(14,12,””);
$this->webDriver->close();
}
}

?>


Complex problems, Simple Solutions