📌  相关文章
📜  通过文本查找 Web 元素 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:57.678000             🧑  作者: Mango

代码示例1
/**
     *Get the Web element from its text
     * @param name
     * @param elementText
     * @return WebElement
     */
    public WebElement getElementByText(String name, String elementText) {
        
        return WebUI.getWebElement("xpath","//a[starts-with(@name, '" + name + "') and (text() = '" + elementText + "' or . = '" + elementText + "')]");
        
    }