gpt4 book ai didi

java - 在 Selenide 中捕获 shouldHave/shouldBe 方法

转载 作者:行者123 更新时间:2023-11-30 06:05:23 27 4
gpt4 key购买 nike

我正在编写一个测试,有可能无法正确加载所有字段。我正在考虑使用简单的 try/catch,但是当我使用

$("select[formcontrolname=\"标识符\"]").shouldBe(禁用);

我得到:

Element should be disabled {input[type="text"]}
Element: '<input class="col-md-8 col-sm-12 col-xs-12 with-tooltip ng-untouched ng-pristine ng-invalid" formcontrolname="identifier" placeholder="e.g. "America" type="text"></input>'
Actual value: enabled

这不是标准异常。我怎样才能捕获它?

最佳答案

您可以捕获任何 Selenide 断言抛出的 AssertionError。

您可能不应该这样做,通常当您的断言在某个超时时间内未得到满足时,您要么有错误,要么有错误的断言。

关于java - 在 Selenide 中捕获 shouldHave/shouldBe 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51440893/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com