C#WebDriver-如何验证按钮的'disabled'属性是否存在 [英] c# webdriver - how can I verify 'disabled' attribute exists for a button

查看:374
本文介绍了C#WebDriver-如何验证按钮的'disabled'属性是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试验证测试页中的某个按钮是否已应用禁用"属性.这是代码:

I'm trying to verify that a button loacted within my test page has a 'disabled' attribute applied to it. Here is the code:

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

我该如何处理'disabled'属性?

How would I go about getting a handle on the 'disabled' attribute?

非常感谢您的帮助

推荐答案

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

I am not using c# but i think you can use getAttribute() method from Webdriver Api.

c#getAttribute

所以应该是这样的:

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

然后您可以断言该值,等等.

And then you can assert this value etc.

这篇关于C#WebDriver-如何验证按钮的'disabled'属性是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆