How to verify an attribute is present in an element using Selenium WebDriver?

前端 未结 6 2091
旧巷少年郎
旧巷少年郎 2020-12-31 02:14

I have many radio buttons on my screen. When a radio button is selected, it has an attribute of checked. When the radio button is not selected, the checked attribute is not

6条回答
  •  难免孤独
    2020-12-31 02:21

    Look here:

    getAttribute(java.lang.String name)

    Returns: The attribute's current value or null if the value is not set.

    Use whatever test framework you're using to assert that the value is null

    Assert.IsNull(getSingleElement(XXX).getAttribute("checked"));

提交回复
热议问题