Geb中的@current_page功能

时间:2016-06-29 16:58:32

标签: groovy geb

WATIR中,每当我们登陆到在运行时创建的页面时(测试用例执行期间),我们就会使用@current_page

我正在寻找Geb中的类似功能。

这里有两页

RegistrationPage.groovy 我提供的地方

static url = "/register.html"

我还有 UserProfilePage.groovy

这里我不能提供任何static url因为它在我提交注册页面后会被创建,它会根据用户名进行更改

示例https://xxxxx.com/paul.html,如果有两个paul,那么https://xxxxx.com/paul2.html

我想用

static content = {
        defaultprofilePic {$("#userprofilepic")}
    } 

UserProfilePage.groovy

中声明

如果我没有使用to关键字,它会让我回到baseURL,如果我使用它会给出该页面上不可用的元素。

但是我认为如果我使用@current_page这样的话会传递

1 个答案:

答案 0 :(得分:0)

您应该使用at(UserProfilePage)将当前页面设置为UserProfilePage的实例,并验证其at checker

相关问题