Checks that the given element exists on the page and is visible.
You can also specify expected attributes of this element.
php
seeElement('.error');
$I->seeElement('//form/input[1]');
$I->seeElement('input', ['name' => 'login']);
$I->seeElement('input', ['value' => '123456']);
strict locator in first arg, attributes in second
$I->seeElement(['css' => 'form input'], ['name' => 'login']);
?>
public seeElement ( $selector, array $attributes = null ) | ||
$selector | ||
$attributes | array |
<?php $I = new WebGuy($scenario); include 'constant.php'; $I->wantTo('Register new user'); $I->amOnPage("/"); $I->see('Registration'); $I->see('Login'); $I->see('Genre'); $I->see('Stations'); $I->click(Registration::$registrationlink); $I->waitForText('Sign Up'); $I->see('Sign Up'); $I->seeElement(Registration::$username); $I->seeElement(Registration::$emailField); $I->seeElement(Registration::$passwordField); $I->seeElement(Registration::$confirmPasswordField); $I->seeElement(Registration::$registrationButton); $I->fillField(Registration::$username, $username); $I->fillField(Registration::$emailField, $email); $I->fillField(Registration::$passwordField, $pass); $I->fillField(Registration::$confirmPasswordField, $pass_conf); $I->click(Registration::$registrationButton);
/** * Verifies that page has at least one success flash message. * * @return void * @since 0.1.0 */ public function hasSuccessFlashMessages() { $this->guy->seeElement(static::$successFlashMessageSelector); }
<?php $I = new WebGuy($scenario); include 'constant.php'; $I->wantTo('Reset my password'); $I->amOnPage('/'); $I->click(LoginPopUp::$loginPopup); $I->waitForText('Create account'); $I->click(ForgotPopUp::$passwordLink); $I->waitForText('Forgot password'); $I->wait(1); $I->waitForElement(ForgotPopUp::$emailField); $I->seeElement(ForgotPopUp::$emailField); $I->seeElement(ForgotPopUp::$resetButton); $I->fillField(ForgotPopUp::$emailField, $email); $I->click(ForgotPopUp::$resetButton); $I->waitForText('Reset password link was sent on your e-mail address');
<?php $I = new WebGuy($scenario); $I->wantTo('install component/module/plugin'); // Direct install URL call $I->amOnPage('/administrator/index.php?option=com_installer'); // Login first $I->fillField("#mod-login-username", 'TestAdmin'); $I->fillField("#mod-login-password", 'PassAdmin'); $I->click('Log in'); // Where i want to be $I->see('Extension Manager: Install'); // Move "directory tab" into foreground $I->seeLink('Install from Directory'); $I->click('Install from Directory'); // -> find input button (Can be found twice) // <div id="directory" // <fieldset class="uploadform"> // <div class="form-actions"> // <input class="btn btn-primary" type="button" onclick="Joomla.submitbutton3()" value="Install"> $I->seeElement('#directory > fieldset > div > input'); $I->click('#directory > fieldset > div > input'); $I->see('was successful');
<?php /** * this acceptance test expects the path http://localhost/winkform/ to point to the directory /example/ * All input elements are inside the TestForm and rendered in the example. */ $I = new WebGuy($scenario); $I->wantTo('see the test form'); $I->amOnPage('/'); $I->see('form', '#container'); // no errors or warnings must be displayed $I->dontSee('error'); $I->dontSee('Error'); $I->dontSee('Warning'); $I->dontSee('warning'); // address field $I->wantTo('check the address field'); $I->see('.address'); $I->seeElement('label[for=address-postal-code]'); $I->seeElement('input#address-postal-code'); $I->seeInField('input#address-postal-code', 'postal code'); $I->see('focus', 'script'); // chained dropdowns $I->wantTo('check the chained dropdowns'); $I->seeElement('select#one'); $I->see('chainedTo', 'script');
<?php $I = new WebGuy($scenario); use Codeception\Util\Locator; $I->wantTo('sing in google'); $I->amOnPage('/'); $I->see('Увійти'); $I->click('Увійти'); $I->appendField('#Email', 'anton.sylantiev'); $I->seeInField('#Email', 'anton.sylantiev'); $I->see('Один обліковий запис. Усі сервіси Google.'); $I->see('Один обліковий запис Google для всіх служб Google'); $I->seeLink('Потрібна допомога?'); $I->see('Створити обліковий запис'); $I->seeElement("//*[@id='next']"); $I->click('Далі'); $I->seeCheckboxIsChecked('#PersistentCookie'); $I->see('Забули пароль?'); include 'const.php'; $I->fillField('Пароль', $pass); $I->see('Увійти'); $I->click('Увійти'); $I->see('Anton'); $I->click(".//*[@id='gbw']/div/div/div[2]/div[4]/div[1]/a/span"); $I->see('Anton Sylantiev'); $I->see('*****@*****.**');
<?php $I = new WebGuy($scenario); include 'constant.php'; $I->wantTo('Login to muzza.life'); $I->amOnPage(LoginPopUp::$URL); $I->click(LoginPopUp::$loginPopup); $I->waitForText(LoginPopUp::$createAccountLink); $I->see(LoginPopUp::$createAccountLink); $I->see(LoginPopUp::$createAccountLink); $I->seeElement(LoginPopUp::$emailField); $I->seeElement(LoginPopUp::$passwordField); $I->seeElement(LoginPopUp::$loginButton); $I->fillField(LoginPopUp::$emailField, $email); $I->fillField(LoginPopUp::$passwordField, $pass); $I->click(LoginPopUp::$loginButton); $I->waitForText($username); $I->wait(3); ///
<?php $I = new WebGuy($scenario); include 'constant.php'; $I->wantTo('Check My mail Box'); $I->amOnUrl('http://temp-mail.ru/option/change'); $I->fillField('//*[@id="input_mail"]', $mail); $I->click('//*[@id="postbut"]'); $I->wait(1); $I->click('//*[@id="click-to-refresh"]'); $I->click('//*[@id="mails"]/tbody/tr/td[2]/a'); $I->waitForElement('//*[@id="templateBody"]/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/div/a'); $I->click('//*[@id="templateBody"]/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/div/a'); $I->waitForText('Create account'); $I->see('Create account'); $I->see('Forgot password?'); $I->seeElement('#email'); $I->seeElement('$password'); $I->seeElement('#loginButton');