c#webdriver-如何验证';已禁用';按钮的属性存在

本文关键字:按钮 存在 属性 验证 何验证 c#webdriver- | 更新日期: 2023-09-27 18:24:05

我正在尝试验证测试页面中的一个按钮是否应用了"disabled"属性

<button type="button" class="btn-1" data-type="plus" data-field="quantity" disabled="disabled">

如何获取"disabled"属性的句柄?

非常感谢您的帮助

c#webdriver-如何验证';已禁用';按钮的属性存在

我没有使用c#,但我认为您可以使用Webdriver Api中的getAttribute()方法。

c#getAttribute

所以应该是这样的:

IWebElement button = locator to button;
button.getAttribute("disabled");

然后你可以断言这个值等等。