[英]TestCafe Typescript - how to assert the value of a disabled html input element?
TestCafe Typescript - how to assert the value of a disabled HTML input element? TestCafe Typescript - 如何断言禁用的 HTML 输入元素的值?
The element is disabled to avoid interaction by the end user.该元素被禁用以避免最终用户的交互。 However, I would like to check that this element contains the expected value.
但是,我想检查此元素是否包含预期值。
example
public async checksomething(text: string) {
const inputElement = this.inputSelector();
await t
.click(this.someDiv())
.expect(inputElement().value)
.contains(text);
}
I tried to reproduce your usage scenario in the following sample:我试图在以下示例中重现您的使用场景:
<input type="text" value="12345" disabled="disabled"/>
async function checksomething (t, text) {
const inputElement = Selector('input');
await t
.expect(inputElement().value)
.contains(text);
}
test(`test`, async t => {
await checksomething(t, '12345');
});
Everything works as expected.一切都按预期工作。 There is no error.
没有错误。 Please take a look at the
this.someDiv
element.请看一下
this.someDiv
元素。 Check if it is visible.检查它是否可见。 If it does not help, please share your sample to reproduce the issue on my machine.
如果没有帮助,请分享您的示例以在我的机器上重现该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.