0
votes

I'm trying to use WordPress CodeCeption to run a script to install WordPress. I'm using PHPBrowser which is a headless browser.

Here is my script:

<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('Setup WordPress');
$I->amOnPage("/wp-admin/setup-config.php?step=1");
$I->see("Below you should enter your database connection details.");
$I->fillField('dbname', 'wordpress_unit_test');
$I->fillField('uname', 'wordpressuser');
$I->click('.button');
$I->click('.button');
$I->fillField('weblog_title', 'AWS Remote Dev Server');
$I->fillField('user_name', 'admin');
$I->fillField('#pass1-text', 'password');
$I->fillField('admin_email', '[email protected]');
$I->click('.button');

It's getting hung up on the password field in the WP install screen. Any idea how to fill this field? I've tried:

$I->fillField('pass1-text', 'password');
$I->fillField('#pass1-text', 'password');

But I keep getting:

 Test  tests/runner/SetupWordPressCept.php
 Step  Fill field "#pass1-text","password"
 Fail  Form field by Label or CSS element with '#pass1-text' was not found.

enter image description here

1
Does WP use JS on this input field? Anybody know? PHPBrowser doesn't run JS. - Jim Maguire
'#pass1-text' makes me think you are targeting an ID, maybe this will work: $I->fillField(['id' => 'pass1-text'], 'password'); - sunomad
sunomad that didn't work. :( It starts out prefilled. I think it's JS somehow. - Jim Maguire
strange, are you sure the ID is correct? If you really think it's JS, you can try running the tests with Selenium - sunomad
It works fine in Selenium, so it's an issue between PHPBrowser and the specific password field in the WP install. Anyone know why? - Jim Maguire

1 Answers

0
votes

PHPBrowser does not support JavaScript, so if you want to check how this page looks for PHPBrowser, you should disable scripts in your browser (for example with NoScript).

In this case pass1 is a ID and admin_password is a name:

$I->fillField('admin_password', 'password');