0

In Geb, I have a page www.something.com/ and a page that has an exact layout, except content is different. (For ex. www.something.com/?pg=2) I have a Page class declared.

class SearchPage extends Page
{
static url = "www.something.com"
static content =
  {
  //my content declarations
  }
  def mySpecialFunction(){..}
}

I can call mySpecialFunction on this searchpage(www.something.com/) by using page.mySpecialFucntion(), but I'm just unsure how to call myspecialFunction() on www.something.com/?pg=2, then www.something.com/?pg=3, and so on. Thank you

1 Answer 1

1

Okay I have it figured out! It was quite simple(as is everything in groovy/geb)

When you navigate to a page, you can add arguements to it via

to SearchPage, "?pg=2"

I then abstracted the number to repeat the action across multiple pages

for(int i =0; endCondition(); i++){
  mySpecialFunction()
  to SearchPage, "?pg=${i}"
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.