PHP code example of cargomedia / webnavigator
1. Go to this page and download the library: Download cargomedia/webnavigator 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/ */
cargomedia / webnavigator example snippets
class MyTest extends \PHPUnit_Framework_TestCase {
/** @var \WebNavigator\Navigator */
private $_navigator;
protected function setUp() {
$capabilities = new \DesiredCapabilities([\WebDriverCapabilityType::BROWSER_NAME => 'phantomjs']);
$driver = \RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
$this->_navigator = new \WebNavigator\Navigator($driver, 'https://www.denkmal.org');
}
protected function tearDown() {
$this->_navigator->quit();
}
public function testAddPage() {
$this->_navigator->get('/events');
$this->_navigator->click('.addButton a');
$this->_navigator->waitForElement('.Denkmal_Page_Add');
$this->assertContains('Event hinzufügen', $this->_navigator->getText('h1'));
$this->assertContains('/add', $this->_navigator->getUrl());
$this->_navigator->takeScreenshot('screenshot.png');
}
}
sh
php vendor/bin/phpunit