我正在使用Behat/Mink测试Drupal 8站点。
我有一个带有IP地址的输入字段,我想确保已经记录了IP地址。我不想检查特定的IP地址,因为它可能会更改,所以我只想确保该字段有一些值。
基于IP地址将包含一个周期的假设,我尝试了以下方法:
Then the "#edit-field-ip-0-value" element should contain "."
但这失败了,错误如下:
The string "." was not found in the HTML of the element matching css "#edit-field-ip-0-value". (Behat\Mink\Exception\ElementHtmlException)
但是,该字段的值为:
172.19.0.1
我也试着这样检查:
Then the "#edit-field-ip-0-value" element should contain "0"
但它失败了,并出现了相同的错误(在元素的HTML中找不到字符串)。
编辑
<input class="js-text-full text-full form-text" data-drupal-selector="edit-field-ip-0-value" type="text" id="edit-field-ip-0-value" name="field_ip[0][value]" value="172.19.0.1" size="60" maxlength="255" placeholder="">