public function testSearch() { $this->webDriver->get($this->url); // find search field by its id $search = $this->webDriver->findElement(WebDriverBy::xpath('html/body/div[1]/div[1]/div/div[2]/form/label')); $search->click(); // typing into field $this->webDriver->getKeyboard()->sendKeys('php-webdriver'); // pressing "Enter" $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER); $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.repo-list-item:nth-child(1) > h3:nth-child(2) > a:nth-child(1)')); $firstResult->click(); // we expect that facebook/php-webdriver was the first result $this->assertContains("php-webdriver", $this->webDriver->getTitle()); $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL()); $this->assertElementNotFound(WebDriverBy::className('avatar')); }
public function testSearch() { $this->webDriver->get($this->url); // find search field by its id $search = $this->webDriver->findElement(WebDriverBy::id('js-command-bar-field')); $search->click(); // typing into field $this->webDriver->getKeyboard()->sendKeys('php-webdriver'); // pressing "Enter" $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER); $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.public:nth-child(1) > h3:nth-child(3) > a:nth-child(1) > em:nth-child(2)')); $firstResult->click(); // we expect that facebook/php-webdriver was the first result $this->assertContains("php-webdriver", $this->webDriver->getTitle()); $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL()); $this->assertElementNotFound(WebDriverBy::className('avatar')); // $this->waitForUserInput(); }
public function applicationRightsResponsibilities() { Automation::grabElementByCssSelector($this->webDriver, 'tr.even:nth-child(6) > td:nth-child(4) > a:nth-child(1) > span:nth-child(1)')->click(); $this->assertEquals('Rights and Responsibilities | NAEYC AMS', $this->webDriver->getTitle()); $this->webDriver->findElement(WebDriverBy::id('edit-field-rights-read-und'))->click(); $this->webDriver->findElement(WebDriverBy::id('edit-field-rights-plan-und'))->click(); $this->webDriver->findElement(WebDriverBy::id('edit-field-rights-verify-und'))->click(); $this->webDriver->findElement(WebDriverBy::id('edit-field-checkbox-list-1-und'))->click(); $this->webDriver->findElement(WebDriverBy::id('edit-field-checkbox-list-2-und'))->click(); $this->webDriver->findElement(WebDriverBy::id('edit-field-text-signature-und-0-value'))->sendKeys('WD'); $this->webDriver->findElement(WebDriverBy::id('edit-submit'))->click(); }
public function doLogOutLogIn() { if ($this->_testMode < 0) { return; } $username = null; $password = null; $driver = $this->webDriver; $driver->get($this->url . "logout.php"); $driver->wait(15, 300)->until(function ($webDriver) { return $webDriver->getCurrentURL() === $this->url . 'index.php'; }); $indexURL = $this->url . 'index.php'; $currentURL = $this->webDriver->getCurrentURL(); $this->assertEquals($indexURL, $currentURL); if ($indexURL !== $currentURL) { $this->markTestSkipped('Logout page failed.'); return; } $this->assertEquals('PHP Job Seeker 2', $this->webDriver->getTitle()); $this->checkHeaderLoads(); try { $username = $this->webDriver->findElement(WebDriverBy::name('auth_username')); $password = $this->webDriver->findElement(WebDriverBy::name('auth_password')); } catch (NoSuchElementException $ex) { $this->markTestIncomplete('This part of the test has not been written.'); return; } $this->assertNotNull($username); $this->assertNotNull($password); if (null === $username || null === $password) { $this->markTestSkipped('Unable to test login screen - fields missing.'); return false; } $username->sendKeys($this->_userName); $password->sendKeys($this->_password)->submit(); $url = $this->webDriver->getCurrentURL(); $this->assertEquals($this->url . "index.php", $url); $this->assertEquals(true, $this->doWaitFor(WebDriverBy::linkText('Log Out'))); }
public function dontSeeInTitle($title) { $this->assertNotContains($title, $this->webDriver->getTitle()); }
public function testSimple() { $this->webDriver->get($this->url); // checking that page title contains word 'NetBeans' $this->assertContains('NetBeans', $this->webDriver->getTitle()); }
/** * @return string */ public function getPageTitle() { return $this->_driver->getTitle(); }
/** * @dataProvider proxies */ public function testHome($proxy) { $this->driver = $this->proxied($proxy); $this->driver->get($this->url); $this->assertContains('WonderNetwork', $this->driver->getTitle()); }
public function testGitHubHome() { $this->webDriver->get($this->url); // checking that page title contains word 'GitHub' $this->assertContains('GitHub', $this->webDriver->getTitle()); }