我尝试使用另一篇文章中的以下内容
driver.find_element_by_name("sub_activate").click().is_enabled()但是得到了这个错误:
AttributeError: 'NoneType' object has no attribute 'is_enabled'
最佳答案
您不需要调用 click()
。只需找到元素并调用 is_enabled()
在上面:
element = driver.find_element_by_name("sub_activate")
print element.is_enabled()
仅供引用,click()
是 WebElement
上的一个方法,它返回 None
。
关于python - 如何验证按钮是否在 Webdriver Python 中启用和禁用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23498151/