0

In Codeception the fillField works fine when I have <input type="text" name="email"> but it does not work when <input type="email" name="email">

I have tried with the following code

$I->fillField('input[name=email]', 'user@domain.com');

Also With $I->fillField('email', 'user@domain.com'); But it does not work. I am getting the following error.

ElementNotVisibleException: Element is not currently visible

Shahjahan Jewel
  • 2,301
  • 24
  • 23

2 Answers2

0

I have never tested on email field still If it doesn't work, you can choose some work arounds like below: -

(1) Using JS

$I->executeJS('window.document.getElementsByName('email')[0].value='###value###'');

(2) Using low level webdriver code : -

$I->executeInSelenium(function (\Webdriver $webdriver) {
    $webdriver->findElement('###XPATH###')->sendKeys(###value###);
});

Again, if you get any Codeception specific issues, please raise them here

I hope it helps.

0

I got the answer actually, Now I can target any form element by XPATH without running executeInSelenium

So in chrome / firefox I inspect the dom and right-click and copy the xpath,

as an example:
$I->fillField('//*[@id="register-form"]/fieldset/section[3]/div/div/label/input', 'user@domain');

And it works great for other form elements too

Shahjahan Jewel
  • 2,301
  • 24
  • 23