如何在Java版Selenium中获取Role这类Computed Properties属性

被检查元素在网页的无障碍(Accessibility)板块下有一组可获取的属性:
Computed Properties Name: "" `aria-labelledby`: Not specified `aria-label`: Not specified `title`: Not specified Role: generic
这些属性归属于Computed Properties类别,在DOM中不可见,是浏览器根据元素定义对其的解析结果。
已尝试以下方法但均未成功:
WebElement.getAttribute("Role") WebElement.getCssValue("Role") WebElement.findElement(By.cssSelector(".computed-property")
内容的提问来源于stack exchange,提问作者Siddhant
相关产品推荐
相关产品推荐

