testing - 如何检查是否在 geb 中找到 href 元素

标签 testing groovy geb

我尝试点击 html css 'a' 但我无法访问它。我该怎么办?

在测试中

waitFor { myelement.displayed }
myelement.click()

class test extends Page {

    static at = { title == "test page" }
    static content = {
        myelement {$("a", id: "myid")}
    }
}

最佳答案

您应该可以使用 ID 直接访问它。我认为您的语法不正确,请尝试改用 ID 选择器:$("#myId")

关于testing - 如何检查是否在 geb 中找到 href 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49608098/

相关文章:

grails - Groovy DAO可变范围问题

testing - Geb和Spock作为集成测试框架

java - Selenium headless Chrome 崩溃,而有头 Chrome 工作得很好

testing - 作为 QA 经历冲刺工作流

groovy - 在 Groovy 中抛出/捕获异常

groovy - 为什么 Groovy 没有捕获我的 instanceof?

testing - 将 Gebish 集成到 Gradle 中

java - 具有服务器发送事件 (SSE) 支持的模拟库

javascript - 无法使用实用 meteor :mocha - file structure issue 运行 meteor 测试

unit-testing - 执行 Go 测试下划线 (_) 代替正确的路径