Skip to content

Instantly share code, notes, and snippets.

@DominicFinn
Last active December 19, 2015 02:39
Show Gist options
  • Select an option

  • Save DominicFinn/5884833 to your computer and use it in GitHub Desktop.

Select an option

Save DominicFinn/5884833 to your computer and use it in GitHub Desktop.
Basic Selenium Automation with PHP and PHPUnit for Jons perusal.
<?php
class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser('firefox');
$this->setBrowserUrl('http://www.example.com/');
}
public function testTitle()
{
$this->url('http://www.example.com/');
$this->assertEquals('Example WWW Page', $this->title());
}
public function clickOnSomething() {
$this->clickOnElement('submitButton');
}
public function getValueOutOfElement() {
$inputfield = $this->byName('txtField');
$this->assertEquals('test text', $inputfield->value());
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment