【发布时间】:2022-03-08 12:02:55
【问题描述】:
我有一个带有三个单选按钮的表单。
<form name="contact">
<label>Type</label>
<label>
<input type="radio" id="car" value="car" checked>Car
</label>
<label>
<input type="radio" id="boat" value="boat">Boat
</label>
<label>
<input type="radio" id="home" value="home">Home
</label>
</form>
我正在用 Protractor 编写集成测试。
我在选择单选按钮值时遇到问题。我已经通过 ID 尝试了clicking:
//click boat
element(by.id('boat')).click();
当我运行测试时,我收到以下错误:
Message:
Failed: No element found using locator: By(css selector, *[id="boat"])
Stack:
NoSuchElementError: No element found using locator: By(css selector, *[id="boat"])
【问题讨论】:
标签: javascript protractor