public function testStrictLocators() { $this->module->amOnPage('/login'); $this->module->seeElement(['id' => 'submit-label']); $this->module->seeElement(['name' => 'password']); $this->module->seeElement(['class' => 'optional']); $this->module->seeElement(['css' => 'form.global_form_box']); $this->module->seeElement(['xpath' => \Codeception\Util\Locator::tabIndex(4)]); $this->module->fillField(['name' => 'password'], '123456'); $this->module->amOnPage('/form/select'); $this->module->selectOption(['name' => 'age'], 'child'); $this->module->amOnPage('/form/checkbox'); $this->module->checkOption(['name' => 'terms']); $this->module->amOnPage('/'); $this->module->seeElement(['link' => 'Test']); $this->module->click(['link' => 'Test']); $this->module->seeCurrentUrlEquals('/form/hidden'); }
public function testWebDriverByLocators() { $this->module->amOnPage('/login'); $this->module->seeElement(WebDriverBy::id('submit-label')); $this->module->seeElement(WebDriverBy::name('password')); $this->module->seeElement(WebDriverBy::className('optional')); $this->module->seeElement(WebDriverBy::cssSelector('form.global_form_box')); $this->module->seeElement(WebDriverBy::xpath(\Codeception\Util\Locator::tabIndex(4))); $this->module->fillField(WebDriverBy::name('password'), '123456'); $this->module->amOnPage('/form/select'); $this->module->selectOption(WebDriverBy::name('age'), 'child'); $this->module->amOnPage('/form/checkbox'); $this->module->checkOption(WebDriverBy::name('terms')); $this->module->amOnPage('/'); $this->module->seeElement(WebDriverBy::linkText('Test')); $this->module->click(WebDriverBy::linkText('Test')); $this->module->seeCurrentUrlEquals('/form/hidden'); }
public function testTabIndex() { $xml = new SimpleXMLElement("<root><a href='#' tabindex='2'>Click Me</a></root>"); $this->assertNotEmpty($xml->xpath(Locator::tabIndex(2))); }