棘手的“密码”使用CodeCeption的WordPress安装脚本中的字段 [英] Tricky "password" field in WordPress install script using CodeCeption
问题描述
我正在尝试使用WordPress CodeCeption运行脚本来安装WordPress。我使用的是无头浏览器PHPBrowser。
I'm trying to use WordPress CodeCeption to run a script to install WordPress. I'm using PHPBrowser which is a headless browser.
这是我的脚本:
<?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', 'admin@email.com');
$I->click('.button');
它已挂在WP安装屏幕的密码字段中。知道如何填写此字段吗?我尝试过:
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');
但我不断得到:
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.
推荐答案
PHPBrowser不支持JavaScript,因此,如果要检查此页面查找PHPBrowser的方式,则应禁用浏览器中的脚本(例如,使用 NoScript )。
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).
在这种情况下, pass1
是一个ID, admin_password
是一个名称:
In this case pass1
is a ID and admin_password
is a name:
$I->fillField('admin_password', 'password');
这篇关于棘手的“密码”使用CodeCeption的WordPress安装脚本中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!