【问题标题】:How to test select box without any option selected with codeception?如何在没有选择任何选项的情况下测试选择框?
【发布时间】:2015-04-19 18:27:33
【问题描述】:

所以字段的值应该是第一个选择的选项。

我看到问题就在这里

public function seeOptionIsSelected($select, $optionText)
{
    $selected = $this->matchSelectedOption($select);
    $this->assertDomContains($selected, 'selected option');
    //If element is radio then we need to check value
    $value = $selected->getNode(0)->tagName == 'option' ? $selected->text() : $selected->getNode(0)->getAttribute('value');
    $this->assertEquals($optionText, $value);
}

【问题讨论】:

    标签: codeception


    【解决方案1】:

    这种情况可以通过以下方式进行测试:

    $I->seeElement("#id_of_the_select_box");
    $I->dontSeeElement("#id_of_the_select_box option[selected='selected']");
    

    【讨论】:

      猜你喜欢
      • 2015-02-23
      • 1970-01-01
      • 1970-01-01
      • 2017-11-29
      • 2013-07-04
      • 2012-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多